Skip to content

Instantly share code, notes, and snippets.

View Harshakvarma's full-sized avatar
🎯
Focusing

Harshavardhan Kalidindi Harshakvarma

🎯
Focusing
View GitHub Profile
@Harshakvarma
Harshakvarma / ical.md
Created September 5, 2018 18:15 — forked from meskarune/ical.md
parsing ical file with python icalendar

Archwomen.ics file

BEGIN:VCALENDAR
PRODID:-//Mozilla.org/NONSGML Mozilla Calendar V1.1//EN
VERSION:2.0
BEGIN:VEVENT
CREATED:20170220T182458Z
LAST-MODIFIED:20170220T182458Z
DTSTAMP:20170220T182458Z
@Harshakvarma
Harshakvarma / MixPanelExport.py
Last active June 19, 2018 06:42 — forked from trentniemeyer/MixPanelExport.py
MixPanel Export API in Python 3
I got it working
```python
import base64
import urllib.request
import ssl
try:
import json
except ImportError:
import simplejson as json
@Harshakvarma
Harshakvarma / README.md
Created May 8, 2018 19:29 — forked from twolfson/README.md
Quick and dirty database dump to S3 via Node.js

We are implementing database dumping which is straightforward but can be tedious to setup. Here's our setup:

  1. Create AWS user for db backups (e.g. db-backups-{{app}})
    • Save credentials in a secure location
    • If adding db scrubbing, use a separate user (e.g db-scrubs-{{app}})
  2. Create bucket for S3 access logging (e.g. s3-access-log-{{app}})
  3. Create consistently named bucket for db dumps (e.g. db-backups-{{app}})
    • Enable logging to s3-access-log-{{app}} with prefix of db-backups-{{app}}
  4. Add IAM policy for bucket access
  • Select user -> Choose "Add inline policy"
@Harshakvarma
Harshakvarma / geo.js
Created April 13, 2018 19:56 — forked from mkhatib/geo.js
A Javascript utility function to generate number of random Geolocations around a center location and in a defined radius.
/**
* Generates number of random geolocation points given a center and a radius.
* @param {Object} center A JS object with lat and lng attributes.
* @param {number} radius Radius in meters.
* @param {number} count Number of points to generate.
* @return {array} Array of Objects with lat and lng attributes.
*/
function generateRandomPoints(center, radius, count) {
var points = [];
for (var i=0; i<count; i++) {
@Harshakvarma
Harshakvarma / server.js
Created March 8, 2018 20:54 — forked from taion/server.js
GraphQL subscription server with Socket.IO, backed by Redis Pub/Sub
const redisClient = redis.createClient(REDIS_URL);
const listeners = Object.create(null);
function addListener(channel, listener) {
if (!listeners[channel]) {
listeners[channel] = [];
redisClient.subscribe(channel);
}
listeners[channel].push(listener);
@Harshakvarma
Harshakvarma / delay.js
Created February 19, 2018 06:39 — forked from daliborgogic/delay.js
Node.js Async/Await delay
'use strict'
const timeout = ms => new Promise(res => setTimeout(res, ms))
function convinceMe (convince) {
let unixTime = Math.round(+new Date() / 1000)
console.log(`Delay ${convince} at ${unixTime}`)
}
async function delay () {