Skip to content

Instantly share code, notes, and snippets.

View sum.js
var add=function()
{
if(arguments.length==0)
{return 0
}
else{
let args=[].slice.call(arguments,0)
args.splice(0,1)
return arguments[0]+add.apply(this,args)//needtoreadaboutapply
View csvtojson.py
from elasticsearch import Elasticsearch
import re
es = Elasticsearch([{'host': 'localhost', 'port': 9200}])
csvfile=open("/home/gaurav/Affiliate_feed.csv","r")
fields=csvfile.readline()
fields=fields.split(",")
jsonobj={}
i=0
for line in csvfile:
View gist:f270961e672dfb5fbbe09a70606ae064
response = {}
someAsyncCall().then(function(rows){
_.forEach(rows, function(row){
if(typeof response[row.key] === 'undefined'){
response[row.key] = {count1:0,count2: row.count}
}
else{
response[row.key][count2]+=row.count
}
}
View gist:87f9a5142ac465c24a7e83624ed40359
{
"requests": [
{
"uuid": "ac4010f9-a2a0-486a-98bc-86435c5024ee",
"ques": {
"uuid": "d8d34485-1924-4adc-b6a6-e4468b60332f",
"created_on": "2016-11-27T19:58:41.538220Z",
"title": "Craving for something spicy, sdsaduggest please?",
"places": [
"5"
View gist:40b3710f9ac8bcbd68e4fd42eb7e1ca9
{
"requests": [
{
"uuid": "ac4010f9-a2a0-486a-98bc-86435c5024ee",
"ques": {
"uuid": "d8d34485-1924-4adc-b6a6-e4468b60332f",
"created_on": "2016-11-27T19:58:41.538220Z",
"title": "Craving for something spicy, sdsaduggest please?",
"places": [
{
View gist:56c08d8ea5fc6215da67b462e9d248c0
critical -
unable to create topic for user
turned of notifications
test and check the email dispatch on landing page
urgent -
move to mysql
better logging
Improvements -
View gist:8e3e4b628058c37be9ec0585f562ffcf
{
"uuid": "b7a6de43-70d0-4294-8221-0407ef2daabd",
"created_on": "2017-01-13T20:05:23.587870Z",
"title": "Craving for something spicy, suggest please?",
"places": [
{
"g_place_id": "5",
"json": "{u'photos': [u'https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreferenceCoQBdwAAAAi0VElPU4iBE4Rd-3FJSD7fkDfLxkJgLyewSth5qLe7Q-1VbkxQFN2ZBarhN_RLH3kgnNO4L2eQhiv2CmuU3TrygFeifzTBJX3Q-vFvRNPAKf4swSOGt4-d563x18TgCoQ3u3OgVZboyi9DnaryIoDOUtecV-1TZs2OJXYI6LEiEhCuGRq8ZEawXh9QCWeYnB4nGhSKKAiAfvUHT-kcvjQK8tU55b5RDQ=&key=AIzaSyAgGUHwXIpoG-5VZ11Llop184jlS4raipw', u'https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreferenceCoQBcwAAAH8MznOpPam7e-4rrRz26BYX6wFTEsjhnbGJAbk0AyXJSWYX9ZpFfsu3pBXrqVPIOYqShcHrFt4tQlpt7Vuz0u0QPcA8sOz7oRX1PQCExg1EOd2uc2f7Ni4TV-S1udlPvd51cAJtk3tz6vn9IkIKQYRzG3yXaGS2A2jiy6-U7Ok-EhDbZflSHhsECRlw4dQPK-krGhTisb048uKy0AyivN8yAd5m_oM-gw=&key=AIzaSyAgGUHwXIpoG-5VZ11Llop184jlS4raipw', u'https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photorefe
View gist:6c616bcbc7eaaec6edb4b9f36fe8c893
{
"uuid": "92bad68c-2f5d-4bd2-a470-961648fc2646",
"created_on": "2017-01-13T20:43:02.709308Z",
"title": "Craving for something spicy, suggest please?",
"places": [
{
"g_place_id": "95",
"json": "{\"photos\": [\"https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=CoQBdwAAAKcpU2K6ZqaVS5Y3j4TLVDRZEB0nEbKXpVk9D8K_FD7BqcpdMW4DJjq7rBZ7uSFCuxC9k0j7C0c40WHPeHxzZMA9s8kBqxVieS4vlyYbBfQUnuJs9nM3f-tmpGeMxBy3ZzLJ6GtY8mtI2KdG1PqCYUhOSjnNqLhS-_08MV5_L0DuEhDlbGE-nBrN96G1y62X41x8GhTUybLJz2GXekXgkQLY5G_xGAO6Pw&key=AIzaSyAgGUHwXIpoG-5VZ11Llop184jlS4raipw\", \"https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photoreference=CoQBdwAAAKEVj0zDeNUXXyvsS-GzBkN_DIVv8e0k9G-hvYtK2hFYCmZ6sQSl6szHaRH8rtlR7RGuuc0TNq2Bqgxfn85mcZG2JPRKZDOaeR0QHNWuQprvQekTbTV76tjsdNr-wKvfhtVxXashGZpSP4PnrblpY0Mc0awTWXpgHgp_7xle3byWEhDV6p41mBnoHhI9kUFTlwmNGhSYC-wdN-3CYNK6jXq7OtonkB4ftw&key=AIzaSyAgGUHwXIpoG-5VZ11Llop184jlS4raipw\", \"https://maps.googleapis.com/maps/api/place/photo?maxwidth=400&photo
View remove-folder.go
func ClearOldFolder(folder string) {
doneCh := make(chan struct{})
defer close(doneCh)
for object := range StorageClient.ListObjectsV2(StaticBucket, "gaurav-test", true, doneCh) {
if object.Err != nil {
fmt.Println(object.Err)
return
}
fmt.Println(object.Key)
err := StorageClient.RemoveObject(StaticBucket,object.Key)
View telegram_add_games.py
import time
import redis
import os
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import requests
from PIL import Image
r = redis.StrictRedis(db=2)
messages = [{
You can’t perform that action at this time.