Skip to content

Instantly share code, notes, and snippets.

View amitu's full-sized avatar
😀
Building fastn.com

Amit Upadhyay amitu

😀
Building fastn.com
View GitHub Profile
@amitu
amitu / hindic-top1000.txt
Last active May 21, 2016 18:47
https://github.com/amitu/scriptic/blob/master/cmu.py generated transliteration for 1000 most frequently used words in english
you: Y UW1 => यू
I: AY1 => आय
to: T UW1 => टू
the: DH AH0 => दै
a: AH0 => ऐ
and: AH0 N D => ऐन्ड
that: DH AE1 T => दैट
it: IH1 T => इट
of: AH1 V => आव
me: M IY1 => मी
@amitu
amitu / find.go
Created April 7, 2015 13:05
gobench 1
// Package bench is a package which contains
// programs of Go Benchmark Competition.
package bench
import (
"bufio"
"errors"
"fmt"
"os"
"strings"
@amitu
amitu / ldap2unix.go
Last active August 29, 2015 14:16
LDAP timestamp to Unix Epoch
package main
import (
"fmt"
"os"
"time"
)
func main() {
if len(os.Args) != 2 {
@amitu
amitu / Makefile
Created February 10, 2015 09:07
how to do static files in django/s3
CURRENT=${shell git rev-parse HEAD}
sync:
./build.sh min
s3cmd sync proj/staticfiles/admin/ s3://static.proj.com/admin/
s3cmd sync proj/staticfiles/latest/ s3://static.proj.com/${CURRENT}/
Verifying that +amitu is my openname (Bitcoin username). https://onename.io/amitu
@amitu
amitu / output_stripper.py
Created July 15, 2014 08:45
Remove output from iPython notebook files.
from IPython.nbformat import current
import io
from os import remove, rename
from shutil import copyfile
from subprocess import Popen
from sys import argv
for filename in argv[1:]:
# Backup the current file
backup_filename = filename + ".backup"
@amitu
amitu / adb.py
Last active August 29, 2015 14:03
#!/usr/bin/env python
from path import path
from struct import unpack
from collections import namedtuple
import stat, os
USBDeviceDescriptor = namedtuple(
"USBDeviceDescriptor", " ".join(
[
@amitu
amitu / net.http.diff
Last active August 29, 2015 14:03
Optionally not creating go routines on HTTP requests: https://groups.google.com/forum/#!topic/golang-nuts/iwCz_pqu8R4
diff -r ceb13960d05b src/pkg/net/http/server.go
--- a/src/pkg/net/http/server.go Thu Mar 13 13:25:59 2014 +0400
+++ b/src/pkg/net/http/server.go Thu Jul 03 21:48:41 2014 +0530
@@ -1615,6 +1615,8 @@
ErrorLog *log.Logger
disableKeepAlives int32 // accessed atomically.
+
+ DisableGoRoutines bool
}
eventsource
go-eventsource
client/client
@amitu
amitu / screenshot.go
Last active July 4, 2019 17:32
screenshot.go
package main
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa -framework Foundation
#import <Cocoa/Cocoa.h>
#import <Foundation/Foundation.h>
NSData *data;