Skip to content

Instantly share code, notes, and snippets.

View infinite-Joy's full-sized avatar

Joydeep Bhattacharjee infinite-Joy

View GitHub Profile
@infinite-Joy
infinite-Joy / get_github_users_language_city.py
Created January 9, 2017 09:17
get the github users according the language and the city
# pip install PyGithub
from github import Github
g = Github("username", "password")
for users in g.search_users("language name", location="location name"):
print(users)
@infinite-Joy
infinite-Joy / bulk_emailing.py
Last active February 3, 2017 08:48
send email to people in bulk using templates from gmail
import yagmail
import csv
import logging
"""
requirements:
pip install yagmail
pip install keyrings.alt
"""
@infinite-Joy
infinite-Joy / flask_show_script_output.py
Created February 5, 2017 18:09
flask app to list out the bash scripts and get the output after executing the bash scripts.
import os
import json
import subprocess
from flask import Flask
from flask import render_template
app = Flask(__name__)
#######################
"""
@infinite-Joy
infinite-Joy / jsonlines_to_csv.py
Created February 14, 2017 10:47
a small script that takes in json lines and create a csv file
import csv
import jsonlines
#import pprint
# open the file and put it in a list
with jsonlines.open("github_emails_data.jl") as f:
json_file = [line for line in f]
#print(pprint.pprint(json_file))
@infinite-Joy
infinite-Joy / github_get_user_primary_languages.py
Created March 1, 2017 08:11
a way to find the primary language preference of github users based on the primary language of the repos they contribute too. This assumes you have the guthub username or login name
import requests
import json
import pprint
def user_name(json_string):
user = json.loads(str(json_string))
return user.get("login")
@infinite-Joy
infinite-Joy / boilerplate_threaded.py
Last active April 22, 2017 07:09
boilerplate code to implement threading
'''
taken from the raymond hettingers take on threading https://dl.dropboxusercontent.com/u/3967849/pyru/_build/html/threading.html
'''
import threading, time, random, queue
##########################################################################################
# Fuzzing is a technique for amplifying race condition errors to make them more visible
FUZZ = True
a=1
function nolocal {
a=2
}
nolocal
echo $a # output 2
a=1
function nolocal {
echo $1
}
echo $(nolocal 2) # output 2
echo $a # output 1
function last_difference
{
grep -n "${pattern}" "${parse_file}" \
| tail -1 | awk '{print $1}' |\
cut -d ":" -f1
}
function all_differences
{
bash-4.2$ x=10
bash-4.2$ echo $((x+1))
11
bash-4.2$ y="10"
bash-4.2$ echo $((y+1))
11