Skip to content

Instantly share code, notes, and snippets.

tmux cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@amitsaha
amitsaha / flask_geventwebsocket_example.py
Created November 28, 2012 14:12 — forked from lrvick/flask_geventwebsocket_example.py
Simple Websocket echo client/server with Flask and gevent / gevent-websocket
from geventwebsocket.handler import WebSocketHandler
from gevent.pywsgi import WSGIServer
from flask import Flask, request, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('index.html')
@amitsaha
amitsaha / sympy_quadratic.rst
Last active December 18, 2015 13:09 — forked from anonymous/sympy_quadratic.py
A bit of SymPy:
>>> from sympy import Symbol, solve, pprint

>>> a=Symbol('a')
>>> b=Symbol('b')
>>> c=Symbol('c')
>>> expr = a*x*x + b*x + c
>>> solve(expr)
[{a: -(b*x + c)/x**2}]

1. Clone your fork:

git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@amitsaha
amitsaha / property-based-testing-tools.md
Last active December 27, 2019 13:45 — forked from npryce/property-based-testing-tools.md
Property-Based Testing Tools

If you're coming to the Property-Based TDD As If You Meant It Workshop, you will need to bring a laptop with your favourite programming environment, a property-based testing library and, depending on the language, a test framework to run the property-based-tests.

Any other languages or suggestions? Comment below.

.NET (C#, F#, VB)

Python:

#!/usr/bin/python
import compiler
import compiler.ast
import optparse
import sys
class MockChecker(object):
def __init__(self):
self.errors = 0
@amitsaha
amitsaha / GoWithC.go
Created July 11, 2016 04:29 — forked from 17twenty/GoWithC.go
Cross Compiling and Language Interop oh my!
package main
import (
"./binding"
"fmt"
)
func main() {
binding.PrintHello()
binding.Seed(1)
fmt.Println(binding.Random())
@amitsaha
amitsaha / .bash_profile
Created August 25, 2016 05:47 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@amitsaha
amitsaha / happy_git_on_osx.md
Created September 21, 2016 04:51 — forked from trey/happy_git_on_osx.md
Creating a Happy Git Environment on OS X

Creating a Happy Git Environment on OS X

Step 1: Install Git

brew install git bash-completion

Configure things:

git config --global user.name "Your Name"

git config --global user.email "you@example.com"

@amitsaha
amitsaha / role_arn_to_session.py
Created September 13, 2017 02:39 — forked from gene1wood/role_arn_to_session.py
Simple python function to assume an AWS IAM Role from a role ARN and return a boto3 session object
import boto3
def role_arn_to_session(**args):
"""
Usage :
session = role_arn_to_session(
RoleArn='arn:aws:iam::012345678901:role/example-role',
RoleSessionName='ExampleSessionName')
client = session.client('sqs')
"""