Skip to content

Instantly share code, notes, and snippets.

andrew giessel andrewgiessel

Block or report user

Report or block andrewgiessel

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
View stars.py
#!/usr/bin/env python
import numpy as np
ship = '🚀'
chars = [' ', '·', '.', '*', '', '', '+', '', '', '.', '', '', '˚']
probs = [ 0.58247423+0.23969072, 0.05927835, 0.04896907, 0.02061856,
0.0128866 , 0.01030928, 0.00515464, 0.00515464, 0.00515464,
0.00257732, 0.00257732, 0.00257732, 0.00257732]
num_lines = 5
View backward hook output
Sequential(
(0): Linear(in_features=10800, out_features=1000, bias=True)
(1): ReLU()
(2): Linear(in_features=1000, out_features=100, bias=True)
(3): ReLU()
(4): Linear(in_features=100, out_features=20, bias=True)
(5): Softmax()
)
Inside Sequential backward
Inside class:Sequential
View gist:392bea1eac057679f84e79a9e262eca5
;; mouse stuff
(xterm-mouse-mode)
(defvar alternating-scroll-down-next t)
(defvar alternating-scroll-up-next t)
(defun alternating-scroll-down-line ()
(interactive "@")
(when alternating-scroll-down-next
; (run-hook-with-args 'window-scroll-functions )
(scroll-down-line 5))
View leaflet.js
/*
Leaflet 1.0.0-beta.2 (81e71fe), a JS library for interactive maps. http://leafletjs.com
(c) 2010-2015 Vladimir Agafonkin, (c) 2010-2011 CloudMade
*/
!function(t,e,i){function n(){var e=t.L;o.noConflict=function(){return t.L=e,this},t.L=o}var o={version:"1.0.0-beta.2"};"object"==typeof module&&"object"==typeof module.exports?module.exports=o:"function"==typeof define&&define.amd&&define(o),"undefined"!=typeof t&&n(),o.Util={extend:function(t){var e,i,n,o;for(i=1,n=arguments.length;n>i;i++){o=arguments[i];for(e in o)t[e]=o[e]}return t},create:Object.create||function(){function t(){}return function(e){return t.prototype=e,new t}}(),bind:function(t,e){var i=Array.prototype.slice;if(t.bind)return t.bind.apply(t,i.call(arguments,1));var n=i.call(arguments,2);return function(){return t.apply(e,n.length?n.concat(i.call(arguments)):arguments)}},stamp:function(t){return t._leaflet_id=t._leaflet_id||++o.Util.lastId,t._leaflet_id},lastId:0,throttle:function(t,e,i){var n,o,s,r;return r=function(){n=!1,o&&(s.apply(i,o
View folium_leaflet_0.7.3.css
/* required styles */
.leaflet-map-pane,
.leaflet-tile,
.leaflet-marker-icon,
.leaflet-marker-shadow,
.leaflet-tile-pane,
.leaflet-tile-container,
.leaflet-overlay-pane,
.leaflet-shadow-pane,
View numpy_array_to_png.py
import numpy as np
import base64, zlib, struct
from IPython.display import HTML
def write_png(buf, width, height):
""" buf: must be bytes or a bytearray in py3, a regular string in py2. formatted RGBARGBA... """
# reverse the vertical line order and add null bytes at the start
width_byte_4 = width * 4
raw_data = b''.join(b'\x00' + buf[span:span + width_byte_4]
View gist:b04e6e91a8470f84480c
import datetime
(datetime.datetime.utcnow() - datetime.datetime(1970, 1, 1)).total_seconds()
View broken.py
import pandas as pd
import numpy as np
df = pd.DataFrame.from_csv('temp.csv')
old_index = df.index
new_index = old_index.union(pd.DatetimeIndex([old_index[5] + np.timedelta64(1,'s')]))
df.reindex(new_index)
View gist:08e5cb531b5bbd24cf6a
import pyproj
wgs84 = pyproj.Proj('+proj=longlat +ellps=WGS84 +datum=WGS84 +no_defs')##4326
geocentric= pyproj.Proj('+proj=geocent +datum=WGS84 +units=m +no_defs') ##4978
for x, y in coords:
x2, y2, z2 = pyproj.transform( wgs84, geocentric, x, y, 0)
View gist:01fb27f936345bc78225
function makePulses(frameLengthsMS, orderedOdors)
global state
sample_rate = getGlobal(progmanager, 'sampleRate', 'ephys', 'ephys');
trace_length_in_samples = round(sum(frameLengthsMS) * length(orderedOdors) * sample_rate/1000);
if trace_length_in_samples == 0
return
end
stim_literal_pulse = zeros(1, trace_length_in_samples);
You can’t perform that action at this time.