Skip to content

Instantly share code, notes, and snippets.

@indraniel
indraniel / colors.nim
Created January 25, 2019 16:36 — forked from jabbalaci/colors.nim
A small program to make using 256 colors in Nim less painful.
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 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 / 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 / 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"
@indraniel
indraniel / replme.sh
Created December 3, 2018 17:51
clj tools version of `lein-try`
#!/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
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()
@indraniel
indraniel / GenotypeGVCF.wdl
Last active November 14, 2018 00:54
Example of the internals of a cromwell script (taken from the GenotypeGVCFs task of the GATK4 pipeline_)
task GenotypeGVCFs {
File workspace_tar
String interval
String output_vcf_filename
String gatk_path
File ref_fasta
File ref_fasta_index
@indraniel
indraniel / tramp-gcloud-ssh
Created September 8, 2018 17:23 — forked from scjody/tramp-gcloud-ssh
EMACS TRAMP setup for "gcloud compute ssh"
;; TRAMP gcloud ssh
(add-to-list 'tramp-methods
'("gssh"
(tramp-login-program "gssh")
(tramp-login-args (("%h")))
(tramp-async-args (("-q")))
(tramp-remote-shell "/bin/sh")
(tramp-remote-shell-args ("-c"))
(tramp-gw-args (("-o" "GlobalKnownHostsFile=/dev/null")
("-o" "UserKnownHostsFile=/dev/null")
@indraniel
indraniel / 1_google_cloud_storage_backup_tutorial.md
Created September 8, 2018 15:09 — forked from rnwolf/1_google_cloud_storage_backup_tutorial.md
Tutorial shows how to make backups to Google Cloud Storage.

Google Cloud Storage backup tutorial

Introduction

This tutorial shows how to make backups to Google Cloud Storage. The backups are:

  • automatic
  • stored off site
  • incremental