Skip to content

Instantly share code, notes, and snippets.

@krishashok
krishashok / twitter_download.py
Created October 3, 2022 08:00
Download all your tweets and pickle them
# This script will download all your (or the logged in user's) tweets and save it as a serialized pickle object
import tweepy
import pickle
# Go to developer.twitter.com, apply to use the API, create a project and get the authorisation details below
API_KEY = ''
API_KEY_SECRET = ''
BEARER_TOKEN = ''
CLIENT_ID = ''
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@krishashok
krishashok / transcribe.py
Last active September 25, 2022 14:51
Script to transcribe iPhone Voice memos on a daily basis and email the transcriptions to yourself
# The Daily Transcriber will take voice notes created on the day the script is run
# from iPhone's voice memo app (via iCloud) and transcribe them using Whisper and email
# the transcriptions to a destination email of choice.
# The best way to set this script up is as a daily cron job
# Requirements
# You will need to enable "Less Secure App Access" on your Gmail account security settings to be able to send emails
# You will also need to install Whisper (follow instructions here - https://github.com/openai/whisper)
# Imports
youtube.com##.ytp-ce-covering-overlay
youtube.com##.ytp-ce-element-shadow
youtube.com##.ytp-ce-covering-image
youtube.com##.ytp-ce-expanding-image
youtube.com##.ytp-ce-element.ytp-ce-video.ytp-ce-element-show
@krishashok
krishashok / election_results.py
Created May 19, 2016 14:51
Extract election results for 2016 state elections from the ECI website into a spreadsheet.
from bs4 import BeautifulSoup
import requests
from xlwt.Workbook import *
from xlwt import easyxf,Formula
#initiatize a bloody excel sheet
wb = Workbook()
#initiatize a sheet on that bloody excel
ws = wb.add_sheet('0')
@krishashok
krishashok / NSDate+DateExtensions.m
Created December 17, 2013 10:09
Category on NSDate to get current time in current timezone (instead of GMT) and also set time component of date to midnight (useful in comparing dates for "same day" situations)
#import "NSDate+DateExtensions.h"
@implementation NSDate (DateExtensions)
+ (NSDate *) currentDateInSystemTimezone
{
NSDate* sourceDate = [NSDate date];
NSTimeZone* sourceTimeZone = [NSTimeZone timeZoneWithAbbreviation:@"GMT"];
NSTimeZone* destinationTimeZone = [NSTimeZone systemTimeZone];