Skip to content

Instantly share code, notes, and snippets.

View t27's full-sized avatar

Tarang Shah t27

View GitHub Profile
@t27
t27 / pgessays.py
Last active September 27, 2015 07:02 — forked from olasitarska/pgessays.py
# -*- coding: utf-8 -*-
"""
Builds epub book out of Paul Graham's essays: http://paulgraham.com/articles.html
Author: Ola Sitarska <ola@sitarska.com>
Copyright: Licensed under the GPL-3 (http://www.gnu.org/licenses/gpl-3.0.html)
This script requires python-epub-library: http://code.google.com/p/python-epub-builder/
"""
@t27
t27 / csvToReadableReport.py
Created May 25, 2015 04:45
A python script to convert a spreadsheet(in CSV format) to a question-answer type document(where the heading of each column is the question and each row is an answer), generally useful to generate readable documents from surveys or similar spread sheets
#a script to convert a spreadsheet to a question-answer type document(where the heading of each column is the question and each row is an answer), generally useful to generate readable documents from surveys or similar spread sheets
import csv
with open('survey.csv', 'rb') as csvfile:
reader = csv.reader(csvfile)
csv_as_list = list(reader)
@t27
t27 / CitylistToLocation.js
Created May 4, 2016 05:07
Geocode a list of cities (or localities) using google's public geocoder. This includes a proper timeout mechanism for sane request intervals. Runs in NodeJS
var request = require('request');
var citylist = require('./data/citylist').citylist; // the array of city names
var i;
var cityDataStore = {};
for (i = 0; i < citylist.length; i++) {
if (i < citylist.length) {
url = 'http://maps.googleapis.com/maps/api/geocode/json?address=' + citylist[i] + '&sensor=false'; // Max 2500 free requests per IP per Day
@t27
t27 / gist:ce9d41fdb2881f75208838b7693f9bf4
Last active July 28, 2016 09:00
TI Tiva launchpad measure function time
SysTickPeriodSet(80000000); // The period should be equal to the system clock time to ensure the systick values are in clock cycle units
SysTickEnable();
while(1) {
t1 = SysTickValueGet(); // clock cycles
a = pe -> getPosition();
t2 = SysTickValueGet(); // clock cycles
time = (t1 - t2); // difference measured in clock cycles
}
@t27
t27 / octolinks.md
Last active January 27, 2020 00:18
Links for All tech stuff @Octoloop
@t27
t27 / renameToEpub.sh
Created December 14, 2016 13:35
Bash script to find all pdf files in a folder and subfolders, use the unix 'file' command to check its actual type and rename to .epub or .html accordingly (used for renaming glitchy google play books takeout files)
EPUBSTR="EPUB document"
HTMLSTR="XML document text"
for f in */*.pdf
do
VAR1=$(file -b "$f")
# echo $VAR1
if [[ "$VAR1" == "$EPUBSTR" ]];
then
fnew=${f/%.pdf/.epub}
mv "$f" "$fnew"
@t27
t27 / kindlePDocsDeleter.js
Last active December 25, 2016 07:40
Script for bulk selecting and deleting Kindle's Personal docs that you email using Send To Kindle through the Amazon website.
v=$('input[id*=chk]');
for(var i =0; i<10;i++) { v[i].click()};
$('#contentAction_delete_myx > div > a > span > button').click();
$('#dialogButton_ok_myx > span > button').click()
.ad_box, .ad_box + .hr {
display: none;
}
.article_preview,body #story {
color: rgba(0,0,0,0.8);
font-family: "FreightText";
letter-spacing: 0.01rem;
line-height: 1.5;
}
@t27
t27 / juhi.ino
Created January 18, 2017 11:27
SparkleSkirt arduino
#include <Wire.h>
#include <Adafruit_Sensor.h>
#include <Adafruit_LSM303.h>
Adafruit_LSM303_Accel_Unified accel = Adafruit_LSM303_Accel_Unified(54321);
// mess with this number to adjust TWINklitude :)
// lower number = more sensitive
#define MOVE_THRESHOLD 45
@t27
t27 / itemlist.md
Last active March 2, 2017 08:43
Items available

Hardware Items Available

BLDC Motors