Skip to content

Instantly share code, notes, and snippets.

@yoavniran
yoavniran / ultimate-ut-cheat-sheet.md
Last active April 13, 2024 16:19
The Ultimate Unit Testing Cheat-sheet For Mocha, Chai, Sinon, and Jest
@petrklus
petrklus / rgb_to_kelvin.py
Last active April 10, 2024 11:20
Kelvin to RGB in python
"""
Based on: http://www.tannerhelland.com/4435/convert-temperature-rgb-algorithm-code/
Comments resceived: https://gist.github.com/petrklus/b1f427accdf7438606a6
Original pseudo code:
Set Temperature = Temperature \ 100
Calculate Red:
If Temperature <= 66 Then
@bmatcuk
bmatcuk / symbolizing_osx_crash_logs.md
Created May 29, 2014 21:43
How to symbolize OSX crash logs

How to Symbolize OSX Crash Logs

Unfortunately, xcode does not yet have support for importing OSX crash logs and symbolizing them. Therefore, you must use the command line and a little bit of manual work.

  1. Find your dSYM file.
    1. Assuming you are using xcode's archive functionality, open the Organizer window from the Window menu.
    2. Click the Archives tab.
    3. Right click on the appropriate build and select Show in Finder.
    4. When Finder opens, right click on the selected archive and select Show Package Contents.
    5. Navigate to the dSYM directory and copy the appropriate dSYM file to a temporary directory.
  2. Then navigate to Products, then Applications, and copy the app file to the same temporary directory.
@bmhatfield
bmhatfield / .profile
Last active March 18, 2024 07:43
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@wbroek
wbroek / genymotionwithplay.txt
Last active February 12, 2024 03:22
Genymotion with Google Play Services for ARM
NOTE: Easier way is the X86 way, described on https://www.genymotion.com/help/desktop/faq/#google-play-services
Download the following ZIPs:
ARM Translation Installer v1.1 (http://www.mirrorcreator.com/files/0ZIO8PME/Genymotion-ARM-Translation_v1.1.zip_links)
Download the correct GApps for your Android version:
Google Apps for Android 6.0 (https://www.androidfilehost.com/?fid=24052804347835438 - benzo-gapps-M-20151011-signed-chroma-r3.zip)
Google Apps for Android 5.1 (https://www.androidfilehost.com/?fid=96042739161891406 - gapps-L-4-21-15.zip)
Google Apps for Android 5.0 (https://www.androidfilehost.com/?fid=95784891001614559 - gapps-lp-20141109-signed.zip)
@jordelver
jordelver / gist:3073101
Created July 8, 2012 22:06
Set the Mac OS X SOCKS proxy on the command line

Set the Mac OS X SOCKS proxy on the command line

a.k.a. what to do when your ISP starts blocking sites :(

Set the SOCKS proxy to local SSH tunnel

networksetup -setsocksfirewallproxy "Ethernet" localhost 8080

To clear the domain and port

@jdmaturen
jdmaturen / company-ownership.md
Last active July 29, 2023 22:39
Who pays when startup employees keep their equity?

Who pays when startup employees keep their equity?

JD Maturen, 2016/07/05, San Francisco, CA

As has been much discussed, stock options as used today are not a practical or reliable way of compensating employees of fast growing startups. With an often high strike price, a large tax burden on execution due to AMT, and a 90 day execution window after leaving the company many share options are left unexecuted.

There have been a variety of proposed modifications to how equity is distributed to address these issues for individual employees. However, there hasn't been much discussion of how these modifications will change overall ownership dynamics of startups. In this post we'll dive into the situation as it stands today where there is very near 100% equity loss when employees leave companies pre-exit and then we'll look at what would happen if there were instead a 0% loss rate.

What we'll see is that employees gain nearly 3-fold, while both founders and investors – particularly early investors – get dilute

@sprhawk
sprhawk / gist:2779208
Created May 24, 2012 03:06
git diff localizable.strings
(from :http://www.entropy.ch/blog/Developer/2010/04/15/Git-diff-for-Localizable-strings-Files.html)
First, add this to the project’s .git/info/attributes file:
+
*.strings diff=localizablestrings
(Unfortunately you do have to add it to every project, there doesn’t seem to be a global attributes configuration file)
Second, add this to your ~/.gitconfig file:
@cecilemuller
cecilemuller / mjpeg.js
Last active December 30, 2022 14:35
Emit a looped serie of images as an MJPEG stream using Node.js
'use strict';
const {readFileSync} = require('fs');
const {createServer} = require('http');
const {EventEmitter} = require('events');
let bufferIndex = -1;
const buffers = [
readFileSync('1.jpg'),
readFileSync('2.jpg'),
readFileSync('3.jpg'),

#Setting up Docker Machine on Raspberry PI

  1. SSH into the pi and install docker with curl -sSL https://get.docker.com | sh (If we let Machine try to install the Docker daemon it will fail.)
  2. Change the OS's ID so Docker Machine won't throw errors. sudo nano /etc/os-release and change the line that says ID=raspbian to ID=debian
  3. From a new terminal window run docker-machine create --driver generic --generic-ip-address YOUR-PIS-IP --generic-ssh-key ~/.ssh/id_rsa --generic-ssh-user pi --engine-storage-driver overlay2 MACHINE-NAME