Skip to content

Instantly share code, notes, and snippets.

View ultrasounder's full-sized avatar
🏠
Working from home

Ananth Sounder ultrasounder

🏠
Working from home
View GitHub Profile
@andypiper
andypiper / readserial.py
Created September 15, 2011 09:56
Scrape serial port for text data and publish on MQTT
#!/usr/bin/python
#
#simple app to read string from serial port
#and publish via MQTT
#
#uses the Python MQTT client from the Mosquitto project
#http://mosquitto.org
#
#Andy Piper http://andypiper.co.uk
#2011/09/15
@ronan-mch
ronan-mch / StackOverflow.py
Created October 24, 2011 20:35
This is a script for scraping the site Stack Overflow's user pages and returning relevant data from the html doc as a csv
#Stack Overflow scraper script
#imports necessary modules
from urllib2 import urlopen
from BeautifulSoup import BeautifulSoup
import time
username = raw_input("Username: ")
@jboner
jboner / latency.txt
Last active May 3, 2024 15:17
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
#!/usr/bin/env python
import sys
import csv
def MeanAveragePrecision(valid_filename, attempt_filename, at=10):
at = int(at)
valid = dict()
for line in csv.DictReader(open(valid_filename,'r')):
valid.setdefault(line['source_node'],set()).update(line['destination_nodes'].split(" "))
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 2, 2024 05:55
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@nathancolgate
nathancolgate / Gemfile
Last active January 31, 2023 01:44
How I built a rails interface on top of the amazing IceCube ruby gem. Video of final product: http://youtu.be/F6t-USuWPag
# Add these two gems
gem 'ice_cube', '0.9.3'
gem 'squeel', '1.0.16'
-- Example Data
DROP TABLE Employees;
DROP TABLE Departments;
CREATE TABLE Departments(DepartmentID INTEGER PRIMARY KEY, Name VARCHAR);
CREATE TABLE Employees(EmployeeID INTEGER PRIMARY KEY, DepartmentID INTEGER, BossID INTEGER, Name VARCHAR, Salary INTEGER);
ALTER TABLE Employees ADD FOREIGN KEY (BossID) REFERENCES Employees(EmployeeID);
ALTER TABLE Employees ADD FOREIGN KEY (DepartmentID) REFERENCES Departments(DepartmentID);
@dideler
dideler / 0-startup-overview.md
Last active May 3, 2024 11:03
Startup Engineering notes
@MarcDiethelm
MarcDiethelm / Contributing.md
Last active May 1, 2024 18:06
How to contribute to a project on Github

This text now lives at https://github.com/MarcDiethelm/contributing/blob/master/README.md. I turned it into a Github repo so you can, you know, contribute to it by making pull requests.


Contributing

If you want to contribute to a project and make it better, your help is very welcome. Contributing is also a great way to learn more about social coding on Github, new technologies and and their ecosystems and how to make constructive, helpful bug reports, feature requests and the noblest of all contributions: a good, clean pull request.

@Chaser324
Chaser324 / GitHub-Forking.md
Last active May 2, 2024 05:49
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j