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
package main
import (
"fmt"
"time"
)
func HandlerCreator() func() {
timer := func() func() {
fmt.Println("Initiating timer")
~/D/ndk ❯❯❯ ls
android-ndk-r18b android-ndk-r18b-linux-x86_64.zip
~/D/ndk ❯❯❯ ls android-ndk-r18b/
build meta ndk-depends ndk-stack NOTICE platforms python-packages shader-tools source.properties sysroot wrap.sh
CHANGELOG.md ndk-build ndk-gdb ndk-which NOTICE.toolchain prebuilt README.md simpleperf sources toolchains
~/g/s/g/sillyfellow ❯❯❯ mkdir wget-go
~/g/s/g/sillyfellow ❯❯❯ cd wget-go
~/g/s/g/s/wget-go ❯❯❯ ls
~/g/s/g/s/wget-go ❯❯❯ vim main.go
~/g/s/g/s/wget-go ❯❯❯ go run main.go
func intersection(s1, s2 string) string {
m := map[rune]bool{}
for _, c := range s1 {
m[c] = true
}
var ret string
for _, c := range s2 {
if _, y := m[c]; y {
@sillyfellow
sillyfellow / reranking-pseudo.go
Last active July 22, 2018 18:14
Pseudocode, heavily influenced by Golang
func RankReposition(newPosition int, siblings List) {
// No siblings, we take the middle spot
if len(siblings) == 0 {
return midWay // 2^63?
}
// Want to be the first one? Take the lowest rank and stand before it
if newPosition == 0 {
result = siblings.first.rank - windowSize
if result < 0 {
#!/bin/bash
# list and export all collections to json using mongoexport, from a specific mongo db
[ $# -ne 1 ] && echo "Usage: $0 <db-name>" && exit 1
DB=${1}
# fetch the list of all collections
COLLECTIONS=$(mongo localhost:27017/$DB --quiet --eval "db.getCollectionNames()" | grep \" | tr -d '\[\]\"[:space:]' | tr ',' ' ')
/*
* Binary Tree
* Binary Search Tree
* AVL Tree
*
* All in pure Javascript, ES6 classes and with inheritance.
*/
package main
import (
"flag"
"net/http"
"time"
log "github.com/sirupsen/logrus"
)
#!/usr/bin/python
from django.conf.urls import RegexURLPattern, RegexURLResolver
from django.core import urlresolvers
urls = urlresolvers.get_resolver()
def if_none(value):
if value:
return value

Keybase proof

I hereby claim:

  • I am sillyfellow on github.
  • I am sillyfellow (https://keybase.io/sillyfellow) on keybase.
  • I have a public key ASADTu1QJtkTII3zZKeGPScfpmaSHvQ3wNT_azx6egldWAo

To claim this, I am signing this object:

#!/bin/bash
# Generate an alphanumeric 16 character password
randpw() {
< /dev/urandom tr -dc _A-Z-a-z-0-9 | head -c${1:-16}
echo
}
# Generate a 16 character password where the adjacent characters are typed with different hands (left/right)
randpwmix() {