git clone git@github.com:YOUR-USERNAME/YOUR-FORKED-REPO.git
cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
#include <string> | |
#include "regex.h" | |
/* | |
* Return a new string with all occurrences of 'from' replaced with 'to' | |
*/ | |
std::string replace_all(const std::string &str, const char *from, const char *to) | |
{ | |
std::string result(str); |
#!/usr/bin/env python | |
""" | |
Very simple HTTP server in python (Updated for Python 3.7) | |
Usage: | |
./dummy-web-server.py -h | |
./dummy-web-server.py -l localhost -p 8000 | |
Send a GET request: |
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, |
#!/bin/sh | |
find . -name *.java -print | xargs sed -i 's/old\.package\.name/new\.package\.name/g' |
Twelve Go Best Practices
Francesc Campoy Flores Gopher at Google @francesc http://campoy.cat/+
/* | |
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 | |
package main | |
import ( | |
"encoding/json" | |
"flag" | |
"io/ioutil" | |
"launchpad.net/xmlpath" | |
"log" | |
"net/http" | |
"strconv" |
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 |
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.