Skip to content

Instantly share code, notes, and snippets.

View hauselin's full-sized avatar

Hause Lin hauselin

View GitHub Profile
@nicolashery
nicolashery / poisson.js
Created June 28, 2013 14:52
Quick JavaScript implementation of Exponential and Geometric random number generators
/* Quick implementation of Exponential and Geometric random number generators
For example you can use it to simulate when an event is going to happen next, given its average rate:
Buses arrive every 30 minutes on average, so that's an average rate of 2 per hour.
I arrive at the bus station, I can use this to generate the next bus ETA:
randomExponential(2); // => 0.3213031016466269 hours, i.e. 19 minutes
*/
@elentok
elentok / fl
Created August 13, 2013 07:47
Open forklift from terminal
#!/bin/bash
# Open current directory in forklift
echo -n $PWD | pbcopy
(cat<<EOF
tell application "Forklift"
activate
tell application "System Events"
@igrigorik
igrigorik / github.bash
Last active October 23, 2024 10:43
Open GitHub URL for current directory/repo...
alias gh="open \`git remote -v | grep [email protected] | grep fetch | head -1 | cut -f2 | cut -d' ' -f1 | sed -e's/:/\//' -e 's/git@/http:\/\//'\`"
@hofmannsven
hofmannsven / README.md
Last active April 30, 2025 15:25
Git CLI Cheatsheet
@wmvanvliet
wmvanvliet / faster.py
Last active January 22, 2022 10:32
First, second and third steps of the FASTER algorithm
import numpy as np
import scipy.signal
import mne
from scipy.stats import kurtosis
from mne.preprocessing import find_outliers
from mne.fixes import nanmean
from mne.utils import logger
#from mne.preprocessing.eog import _get_eog_channel_index
@squarefrog
squarefrog / alfred-query-test.py
Created June 17, 2015 13:19
Workaround for multiline Alfred input in a Python workflow
'''
Pasting in multiline text, eg:
This is
some text
fails when using the following, Alfred provided starting point.
'''
# Breaks ALL the things..
query = '{query}'
@edeno
edeno / parSave.m
Last active November 16, 2018 03:21
Matlab wrapper function for save for use in parfor loops
% Wrapper function for save for use in parfor loops
% Based on http://www.mathworks.com/matlabcentral/answers/135285#answer_149537
% Handles save options such as -append
%
% Test Example 1
% a = 10;
% b = 'blah';
% c.test = 1;
% d = {'a'};
% e = [100 100];
@adamabernathy
adamabernathy / linspace.js
Created December 2, 2016 17:30
Creates a linearly spaced array
/**
* Create a linearly spaced array
*
* @param {number} start - starting integer
* @param {number} nvalues - how many values
* @param {number} interval - interval (optional)
*/
function __linspace(start, nvalues, interval) {
if (typeof interval === "undefined") { interval = 0; }
var i;
@adam-garcia
adam-garcia / README.md
Last active April 23, 2024 09:41
Viridis Color Palette Generator

Viridis Color Palette Generator

A simple tool for extracting discrete color palette values from the viridis collection of color palettes.

@jobonaf
jobonaf / app.R
Created June 22, 2017 12:35
shiny app redirection
server <- function(input, output, session) {}
ui <- fluidPage(singleton(tags$head(tags$script('window.location.replace("https://sdati.arpae.it/calicantus-intro");'))))
shinyApp(ui = ui, server = server)