Skip to content

Instantly share code, notes, and snippets.

Indraniel indraniel

Block or report user

Report or block indraniel

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@indraniel
indraniel / gh-pages.md
Created Dec 17, 2019 — forked from ramnathv/gh-pages.md
Creating a clean gh-pages branch
View gh-pages.md

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 Apr 22, 2019 — forked from drmalex07/gnuplot-py-example.py
A simple example for Gnuplot.py. #python #gnuplot
View gnuplot-py-example.py
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 Jan 26, 2019 — forked from john2x/00_destructuring.md
Clojure Destructuring Tutorial and Cheat Sheet
View 00_destructuring.md

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 / colors.nim
Created Jan 25, 2019 — forked from jabbalaci/colors.nim
A small program to make using 256 colors in Nim less painful.
View colors.nim
import strformat
import tables
# A small program to make using 256 colors in Nim less painful.
# Original ZSH version from:
# P.C. Shyamshankar <sykora@lucentbeing.com>
# Copied from https://github.com/sykora/etc/blob/master/zsh/functions/spectrum/
# Nim rewrite by Laszlo Szathmary <jabba.laci@gmail.com>
# thanks to narimiran and kickeroo for making the code more idiomatic Nim code
@indraniel
indraniel / gist:9d3955f87c6b564492e688fb9c32090b
Created Jan 1, 2019 — forked from drorata/gist:b05bfd59c45eec0470f6
Nice output of pandas.DataFrame in org-mode
View gist:9d3955f87c6b564492e688fb9c32090b
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 / chicken-repl.md
Last active Jan 2, 2019
Chicken Scheme scratches
View chicken-repl.md
$ 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 / GitHub curl.sh
Created Dec 4, 2018 — 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
View GitHub curl.sh
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"
@indraniel
indraniel / replme.sh
Created Dec 3, 2018
clj tools version of `lein-try`
View replme.sh
#!/bin/sh
# tools-deps equivalent of `lein-try`
#
# Additionally see:
#
# https://github.com/hagmonk/find-deps -- what user/find-deps links to
# https://github.com/juxt/edge/blob/master/main/aliases/rebel/edge/rebel/main.clj
# https://clojars.org/seancorfield/depstar -- clj-based uberjarrer
View Running and Writing Output to console at the same time
p = subprocess.Popen(shlex.split(cmd), stdout=subprocess.PIPE)
# Grab stdout line by line as it becomes available. This will loop until
# p terminates.
while p.poll() is None:
l = p.stdout.readline() # This blocks until it receives a newline.
print l
# When the subprocess terminates there might be unconsumed output
# that still needs to be processed.
print p.stdout.read()
You can’t perform that action at this time.