Skip to content

Instantly share code, notes, and snippets.

View Shaunakde's full-sized avatar

Shaunak De Shaunakde

View GitHub Profile
@Shaunakde
Shaunakde / .screenrc
Created November 22, 2023 16:54
Sane and minimal bottom status line for `screen`
hardstatus alwayslastline "%{b kw}%H %{r}%1` %{w}| %{g}%c %{w}| %{y}%d.%m.%Y %{w}| %{g}%l %{w}| %{-b kw}%u %-Lw%{= rW}%50> %n%f %t %{-}%+Lw%<"
@Shaunakde
Shaunakde / dask_map_blocks_dims.py
Created January 12, 2021 01:34
Dealing with reduced dimensions in Dask `map_blocks`
# A method that adds a diagonal line:
def brighten(chunk):
chunk_out = chunk[0] + np.eye(chunk[0].shape[0])
return chunk_out[None,:5,:5] # The key here is to use None or newaxis
# Make the array
arr = da.from_array(np.zeros((2,100,100)), chunks=(2,10,10))
# Examine the array shape
arr.shape
@Shaunakde
Shaunakde / fast-rsync.md
Created November 30, 2020 21:21
Fast rsync from mac to linux

This set of parameters experimentally seems to work the best for macos to linux file transfer. This is ofcourse not secure and is intended for transferring things like machine learning datasets to a workstation from a laptop etc.

Command

rsync -rltv --progress --human-readable --delete -e 'ssh -T -c aes128-gcm@openssh.com -o Compression=no -x'

Explaination

  • r: Recursive. Allow directories to be traversed and copied.

Keybase proof

I hereby claim:

  • I am shaunakde on github.
  • I am shaunakde (https://keybase.io/shaunakde) on keybase.
  • I have a public key whose fingerprint is 7F8D 092D 60F8 28A1 7A40 E3B0 ED25 C050 26A7 C2F6

To claim this, I am signing this object:

@Shaunakde
Shaunakde / normal_variate.py
Last active January 15, 2016 05:27
Generate 1 million random numbers from the normal distribution with a set mu and sigma
from matplotlib import pyplot as plt
import random as r
sampleSize = 1000000 #1 million
mu = 1
sigma = 5
r.seed()
output = []
montage -background '#FFFFFF' -font Courier-10-Pitch-Bold -label "Iteration: %f" -geometry +5+5 -pointsize 20 -tile 2 -gravity South 800 8400 9600 10200 10800 100000 Combined.PNG
shaunak@DEEPSPACE:~/Report/Evolution_of_nn$ montage -background '#FFFFFF' -font Courier-Bold -label "Iteration: %f" -geometry +5+5 -pointsize 20 -tile 2 800 8400 9600 10200 10800 100000 Combined.PNG
@Shaunakde
Shaunakde / colormap_legend.py
Created December 9, 2015 06:00
Plot a colormap for inclusion in figures using matplotlib
def show_colormap(cmap):
im = np.outer(np.ones(10), np.arange(100))
fig, ax = plt.subplots(1,1, figsize=(6, 1.5),
subplot_kw=dict(xticks=[], yticks=[]))
fig.subplots_adjust(hspace=0.1)
ax.imshow(im, cmap=cmap)
show_colormap('jet')
@Shaunakde
Shaunakde / pie_ploy.py
Created November 12, 2015 04:43
Code snippet to plot lots of pie charts in python
# -*- coding: utf-8 -*-
"""
Program to plot many pie charts
Created on Tue Nov 10 15:00:39 2015
@author: shaunak
"""
from pylab import *
@Shaunakde
Shaunakde / index.html
Created May 21, 2015 17:28
App to enter stylized text using ReactJS // source http://jsbin.com/zetoco
<!DOCTYPE html>
<html>
<head>
<script src="http://fb.me/react-0.12.0.js"></script>
<script src="https://fb.me/JSXTransformer-0.13.3.js"></script>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
@Shaunakde
Shaunakde / index.html
Created May 21, 2015 13:26
Multi-component in react JS // source http://jsbin.com/zetoco
<!DOCTYPE html>
<html>
<head>
<script src="http://fb.me/react-0.12.0.js"></script>
<script src="https://fb.me/JSXTransformer-0.13.3.js"></script>
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">