Skip to content

Instantly share code, notes, and snippets.

View sillyfellow's full-sized avatar
:octocat:
Why be normal?

Sandeep Sadanandan sillyfellow

:octocat:
Why be normal?
View GitHub Profile
@sillyfellow
sillyfellow / ImageMagick 6.8.9-10 Homebrew Formula.md
Last active August 12, 2021 08:17 — forked from yvbeek/ImageMagick 6.9.7-8 Homebrew Formula.md
Homebrew Formula for ImageMagick 6.8.9-10

Homebrew Formula patching old ImageMagick release 6.8.9-10

Install

brew install https://gist.github.com/sillyfellow/5ab9ff42705c27868946ca75fb443d0a/raw/6bb85dc345711f6cff0b52231ef4bd5f2bd210e6/imagemagick.rb

Pin this version

To prevent upgrades you can pin this version.

import (
"crypto/rand"
"encoding/binary"
)
func randUInt32() (uint32, error) {
bytes := make([]byte, 4)
_, err := rand.Read(bytes)
return binary.BigEndian.Uint32(bytes), err
}
@sillyfellow
sillyfellow / time_in_words.js
Last active May 9, 2016 12:50
Poor man's descriptive time stuff
function pluralize(count, name) {
var suffix = (count == 1) ? "" : "s"
return count + name + suffix
};
function secondsToDescriptiveTime(seconds) {
var DAYCOUNT = 86400
var HOURCOUNT = 3600
var MINUTECOUNT = 60
#!/bin/bash -
#===============================================================================
# FILE: Mind Trainder
# USAGE: ./mind_trainer.sh
#
# DESCRIPTION: Train your mind to quickly find your income as a freelancer.
# AUTHOR: Dr. Sandeep Sadanandan (sillyfellow), [email protected]
#===============================================================================
set -o nounset # Treat unset variables as an error
@sillyfellow
sillyfellow / auth.go
Created January 21, 2016 15:10 — forked from tristanwietsma/auth.go
Golang web server example
package main
import (
"encoding/base64"
"net/http"
"strings"
)
type handler func(w http.ResponseWriter, r *http.Request)
#!/usr/bin/python3
import csv
import json
import urllib.request
import urllib.parse
from time import sleep
def parse_json_response(response):
content = response.readall().decode('utf-8')
@sillyfellow
sillyfellow / count_android_methods.rb
Last active September 17, 2015 07:18 — forked from toms972/count_android_methods.rb
Android environment has a limitation of maximum 65536 methods definition Here is a ruby script that helps to count the number of methods per each jar.
#!/usr/bin/env ruby
class CountAndroidMethods
def count(path)
full_folder_path = File.expand_path(path)
total_count = 0
# Traverse the folder
Dir.entries(full_folder_path).each {|file|
#!/usr/bin/python
import numpy as np
from random import randint
def gen_points(a, b, num_divisions):
if num_divisions == 0:
return [a]
xdiff = b[0] - a[0]
ydiff = b[1] - a[1]
def cons(list, count):
if count <= 0:
count = 1
for i in range(len(list) - count + 1):
yield list[i: i+count]
@sillyfellow
sillyfellow / drive.py
Last active August 29, 2015 14:08 — forked from basuke/drive.py
#
# python drive.py "origin" ["waypoint" ... ] "destination"
#
# i.e. python drive.py "Union Square, San Francisco" "Ferry Building, San Francisco" 'Bay Bridge' SFO
import sys, json, urllib2, md5, os.path, pprint
from math import radians, sin, cos, atan2, pow, sqrt
from urllib import quote_plus
from xml.sax.saxutils import escape
from optparse import OptionParser