Skip to content

Instantly share code, notes, and snippets.

@indraniel
indraniel / 1-make-patches.sh
Created May 1, 2020 07:46
technique to transfer commits from one git repository to another different git repository
#!/bin/bash
# select the relevant commits i would like to take from source git repoA
mkdir -p patches
git format-patch -1 --stdout 8adb447ccbfd88bf57a571105f6af3b000f343c5 >patches/1.patch
git format-patch -1 --stdout 8f71637c2e407aa8d9e040b1f8168cd5bc9590a4 >patches/2.patch
git format-patch -1 --stdout 968ac4b5e74abf26cf3e53c6f2a1722e8ab62de3 >patches/3.patch
git format-patch -1 --stdout d7c13e31b502049c436d898b037729d08b6078a0 >patches/4.patch
git format-patch -1 --stdout e00ddb86adebb2d528a08abd91bfd7237d32a07e >patches/5.patch
@indraniel
indraniel / toy-bleve-goleveldb-test.go
Last active January 22, 2020 09:02
A test bleve program that uses goleveldb as its backend storage
package main
// goleveldb test
// mentioned in bleve google group
// https://groups.google.com/forum/#!topic/bleve/aHZ8gmihLiY
//
// Based on an earlier toy program using bleve defaults (including BoltDB):
// https://gist.github.com/indraniel/8108bd7def9b5e222417
import (
@indraniel
indraniel / gh-pages.md
Created December 17, 2019 13:50 — forked from ramnathv/gh-pages.md
Creating a clean gh-pages branch

Creating a clean gh-pages branch

This is the sequence of steps to follow to create a root gh-pages branch. It is based on a question at [SO]

cd /path/to/repo-name
git symbolic-ref HEAD refs/heads/gh-pages
rm .git/index
git clean -fdx
echo "My GitHub Page" > index.html
@indraniel
indraniel / gnuplot-py-example.py
Created April 22, 2019 16:36 — forked from drmalex07/gnuplot-py-example.py
A simple example for Gnuplot.py. #python #gnuplot
import numpy
import Gnuplot
def rainfall_intensity_t10(t):
return 11.23 * (t**(-0.713))
def rainfall_intensity_t50(t):
return 18.06 * (t**(-0.713))
g = Gnuplot.Gnuplot()
@indraniel
indraniel / 00_destructuring.md
Created January 26, 2019 22:01 — forked from john2x/00_destructuring.md
Clojure Destructuring Tutorial and Cheat Sheet

Clojure Destructuring Tutorial and Cheat Sheet

(Related blog post)

Simply put, destructuring in Clojure is a way extract values from a datastructure and bind them to symbols, without having to explicitly traverse the datstructure. It allows for elegant and concise Clojure code.

Vectors and Sequences

@indraniel
indraniel / chicken-repl.md
Last active January 2, 2019 18:13
Chicken Scheme scratches
$ rlwrap csi

#;1> (import (prefix (chicken process) p:))
; loading /usr/local/Cellar/chicken/5.0.0/lib/chicken/9/chicken.process.import.so ...

#;2> (p:system "ls")
Applications			Library				bin
0
@indraniel
indraniel / gist:9d3955f87c6b564492e688fb9c32090b
Created January 1, 2019 23:40 — forked from drorata/gist:b05bfd59c45eec0470f6
Nice output of pandas.DataFrame in org-mode
import pandas as pd
import numpy as np
from tabulate import tabulate

df = pd.DataFrame(np.random.random((4,3)), columns=['A','B','C'])
print("foo")
return(tabulate(df, headers="keys", tablefmt="orgtbl"))
@indraniel
indraniel / read-file.scm
Created May 12, 2018 15:35
An example file reading script with chicken scheme
#!/usr/bin/env csi -ss
;; An example file reading script with chicken scheme
(use extras)
(define (read-it file)
(let ((fh (open-input-file file)))
(let loop((c (read-line fh)))
(if (eof-object? c)
@indraniel
indraniel / GitHub curl.sh
Created December 4, 2018 20:50 — forked from Integralist/GitHub curl.sh
Download a single file from a private GitHub repo. You'll need an access token as described in this GitHub Help article: https://help.github.com/articles/creating-an-access-token-for-command-line-use
curl --header 'Authorization: token INSERTACCESSTOKENHERE' \
--header 'Accept: application/vnd.github.v3.raw' \
--remote-name \
--location https://api.github.com/repos/owner/repo/contents/path
# Example...
TOKEN="INSERTACCESSTOKENHERE"
OWNER="BBC-News"
REPO="responsive-news"