Skip to content

Instantly share code, notes, and snippets.

Avatar

Shaunak De Shaunakde

View GitHub Profile
@Shaunakde
Shaunakde / dask_map_blocks_dims.py
Created Jan 12, 2021
Dealing with reduced dimensions in Dask `map_blocks`
View dask_map_blocks_dims.py
# 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 Nov 30, 2020
Fast rsync from mac to linux
View fast-rsync.md

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.
View keybase.md

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 Jan 15, 2016
Generate 1 million random numbers from the normal distribution with a set mu and sigma
View normal_variate.py
from matplotlib import pyplot as plt
import random as r
sampleSize = 1000000 #1 million
mu = 1
sigma = 5
r.seed()
output = []
View image_montage
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 Dec 9, 2015
Plot a colormap for inclusion in figures using matplotlib
View colormap_legend.py
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 Nov 12, 2015
Code snippet to plot lots of pie charts in python
View pie_ploy.py
# -*- 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
App to enter stylized text using ReactJS // source http://jsbin.com/zetoco
View index.html
<!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
Multi-component in react JS // source http://jsbin.com/zetoco
View index.html
<!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
Playing around with ReactJS - props and state demo // source http://jsbin.com/zetoco
View index.html
<!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">