Skip to content

Instantly share code, notes, and snippets.

View ericoporto's full-sized avatar
🎮
making

Érico Porto ericoporto

🎮
making
View GitHub Profile
@alco
alco / glob_match.cc
Created February 20, 2012 14:41
A translation of Python's fnmatch function into C++
#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);
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

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
@bradmontgomery
bradmontgomery / dummy-web-server.py
Last active June 11, 2024 08:36
a minimal http server in python. Responds to GET, HEAD, POST requests, but will fail on anything else.
#!/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:
@tonyblundell
tonyblundell / ago.py
Created May 10, 2012 10:43
ago: Calculate a '3 hours ago' type string from a python datetime.
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,
@Tapchicoma
Tapchicoma / java-package-rename.sh
Created December 28, 2012 08:43
Rename java package name in command line
#!/bin/sh
find . -name *.java -print | xargs sed -i 's/old\.package\.name/new\.package\.name/g'
@pzurek
pzurek / Twelve_Go_Best_Practices.md
Last active March 16, 2024 14:19
Twelve Go Best Practices
@acturcato
acturcato / ACT_WEATHER.ino
Last active December 22, 2022 04:38
Web Client to consume Weather Underground web service (RESTful and JSON formats). 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. Created 07 Jan 2014 by Afonso C. Turcato. Arduino ID…
/*
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"
@sangeeths
sangeeths / github-to-bitbucket
Created March 10, 2014 15:24
Forking a Github repo to Bitbucket
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
@ndarville
ndarville / webm.md
Last active September 30, 2023 18:56
4chan’s guide to converting GIF to WebM - https://boards.4chan.org/g/res/41212767

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.