I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!
\
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Step 1. Open default MIDI-device or die | |
int rc = midiOutOpen(&midi_device, 0, 0, 0, CALLBACK_NULL); | |
if (rc != MMSYSERR_NOERROR) { | |
return FALSE; | |
} | |
// Step 2. Set instrument for a channel (0..15) | |
DWORD command = (0x000000C0 | CHANNEL) | (INSTRUMENT << 8); | |
midiOutShortMsg(midi_device, command); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This software is in the public domain. Where that dedication is not recognized, | |
* you are granted a perpetual, irrevokable license to copy and modify this file | |
* as you see fit. | |
* | |
* Requires SDL 2.0.4. | |
* Devices that do not support Metal are not handled currently. | |
**/ | |
#import <UIKit/UIKit.h> |
Grab ffmpeg from https://www.ffmpeg.org/download.html
It's a command line tool which means you will have to type things with your keyboard instead of clicking on buttons.
The most trivial operation would be converting gifs:
ffmpeg -i your_gif.gif -c:v libvpx -crf 12 -b:v 500K output.webm
-crf
values can go from 4 to 63. Lower values mean better quality.-b:v
is the maximum allowed bitrate. Higher means better quality.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Go to Bitbucket and create a new repository (its better to have an empty repo) | |
git clone git@bitbucket.org:abc/myforkedrepo.git | |
cd myforkedrepo | |
Now add Github repo as a new remote in Bitbucket called "sync" | |
git remote add sync git@github.com:def/originalrepo.git | |
Verify what are the remotes currently being setup for "myforkedrepo". This following command should show "fetch" and "push" for two remotes i.e. "origin" and "sync" | |
git remote -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"flag" | |
"io/ioutil" | |
"launchpad.net/xmlpath" | |
"log" | |
"net/http" | |
"strconv" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Web Client to consume Weather Underground web service | |
This sketch connects to a website (http://api.wunderground.com) | |
using an Arduino Ethernet shield and get data from site. | |
Circuit: | |
* Arduino MEGA 2560 R3 Board | |
* Ethernet shield attached to pins 10, 11, 12, 13 | |
Twelve Go Best Practices
Francesc Campoy Flores Gopher at Google @francesc http://campoy.cat/+
- Best practices
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
find . -name *.java -print | xargs sed -i 's/old\.package\.name/new\.package\.name/g' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
def ago(t): | |
""" | |
Calculate a '3 hours ago' type string from a python datetime. | |
""" | |
units = { | |
'days': lambda diff: diff.days, | |
'hours': lambda diff: diff.seconds / 3600, | |
'minutes': lambda diff: diff.seconds % 3600 / 60, |