Skip to content

Instantly share code, notes, and snippets.

View samatt's full-sized avatar

Surya Mattu samatt

View GitHub Profile
@eyeseast
eyeseast / python.md
Last active May 6, 2024 17:11
How to set up Python in 2022

I have an updated version of this on my blog here: https://chrisamico.com/blog/2023-01-14/python-setup/.

Python

This is my recommended Python setup, as of Fall 2022. The Python landscape can be a confusing mess of overlapping tools that sometimes don't work well together. This is an effort to standardize our approach and environments.

Tools and helpful links:

  • Python docs: https://docs.python.org/3/
  • Python Standard Library:  - Start here when you're trying to solve a specific problem
@kylemcdonald
kylemcdonald / channel-hop.m
Last active November 17, 2016 17:49
Low-overhead channel hopper for OSX.
// based on https://gist.github.com/pavel-a/77eb3295fcefdf2bc992
// build with:
// $ clang -framework Foundation -framework CoreWLAN channel-hop.m -o channel-hop
int hopDelay = 200; // milliseconds
int n = 5;
int channelList[] = {40, 44, 48, 52, 56};
int channelWidthList[] = {80, 80, 80, 80, 80};
#import <Foundation/Foundation.h>
@kylemcdonald
kylemcdonald / Fast Probability Distribution Generation.ipynb
Created March 30, 2016 16:10
Fast generation of random numbers given a probability distribution.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
// compare to: https://github.com/dominictarr/hyperscript/blob/master/index.js (lol)
var e = function(/* tag, attrs, text, children...*/ ) {
var args = [].slice.call(arguments);
var tag = args.shift() || 'div';
var atts = args.shift() || {};
var text = args.shift() || '';
var kids = args;
var el = document.createElement(tag);
Object.keys(atts).forEach(function(k) {
@chbrown
chbrown / _upgrade-pg9.4-to-pg9.5.md
Last active October 7, 2021 13:57
Upgrade PostgreSQL 9.4 to 9.5 on Mac OS X with Homebrew

First, check your current config (example output in homebrew.mxcl.postgresql.plist.xml lower down in this gist):

cat ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist

Most importantly, note the -D /usr/local/var/postgres argument.

Second, shut down your current PostgreSQL.

launchctl unload ~/Library/LaunchAgents/homebrew.mxcl.postgresql.plist
@arkival
arkival / intel-edison-cmdline.md
Last active March 21, 2018 00:31
C/C++ cross compilation from the command line for the Intel Edison

C/C++ cross compilation from the command line for the Intel Edison

It is not necessary to use the Eclipse environment in order to compile code for the Intel Edison. Command line compilation is possible on all platforms and is relatively straightforward. For linux and OS/X the simplest method is to download the SDK for the respective platform and setup as described below. Although Intel lists SDKs for both 32 and 64 bit Windows, I find it simpler to setup command line compilation from the integrated IOT platform installation.

All three platforms use the GNU compiler tools (gcc, g++, and friends) and the main differences really come down to differences in the command shell usage. Consequently, the procedures have the following common elements.

  1. Install the cross compilation tool chain and library file-system.
  2. Setup the path so that the operating system can find the compilers and other utilities.
  3. Setup environment variables to simplify the command line and tell the compilers where to find librari
@octocat
octocat / .gitignore
Created February 27, 2014 19:38
Some common .gitignore configurations
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
*.so
# Packages #
@wizardishungry
wizardishungry / kal.out
Last active December 10, 2017 21:52
Running kalibrate-rtl to look for error offset for rtl device.
506 pyramid:~/Projects/kalibrate-rtl (master %)$ src/kal --h
kalibrate v0.4.1-rtl, Copyright (c) 2010, Joshua Lackey
modified for use with rtl-sdr devices, Copyright (c) 2012, Steve Markgraf
Usage:
GSM Base Station Scan:
kal <-s band indicator> [options]
Clock Offset Calculation:
kal <-f frequency | -c channel> [options]
@why-not
why-not / gist:4582705
Last active February 1, 2024 00:44
Pandas recipe. I find pandas indexing counter intuitive, perhaps my intuitions were shaped by many years in the imperative world. I am collecting some recipes to do things quickly in pandas & to jog my memory.
"""making a dataframe"""
df = pd.DataFrame([[1, 2], [3, 4]], columns=list('AB'))
"""quick way to create an interesting data frame to try things out"""
df = pd.DataFrame(np.random.randn(5, 4), columns=['a', 'b', 'c', 'd'])
"""convert a dictionary into a DataFrame"""
"""make the keys into columns"""
df = pd.DataFrame(dic, index=[0])