Skip to content

Instantly share code, notes, and snippets.

View tpinto's full-sized avatar

Tiago Pinto tpinto

View GitHub Profile
#!/bin/bash
realpath() {
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
}
FILE_PATH=$(realpath $0)
# File directory path
DIR_NAME=$(dirname "${FILE_PATH}")
@protrolium
protrolium / ffmpeg.md
Last active June 15, 2024 01:28
ffmpeg guide

ffmpeg

Converting Audio into Different Formats / Sample Rates

Minimal example: transcode from MP3 to WMA:
ffmpeg -i input.mp3 output.wma

You can get the list of supported formats with:
ffmpeg -formats

You can get the list of installed codecs with:

@vaites
vaites / font-face.sh
Created November 18, 2014 19:26
Convert any EOT/OTF/TTF font to all required @font-face and shows a ready-to-use CSS code
#!/bin/bash
# dependencies
FONTFORGE=`which fontforge`
TTFAUTOHINT=`which ttfautohint`
# base checks
if [ "x$1" == "x" ]; then
echo "Usage: ./font-forge.sh [FILE]"
exit
(Chapters marked with * are already written. This gets reorganized constantly
and 10 or so written chapters that I'm on the fence about aren't listed.)
Programmer Epistemology
* Dispersed Cost vs. Reduced Cost
* Verificationist Fallacy
* Mistake Metastasis
The Overton Window
Epicycles All The Way Down
The Hyperspace Gates Were Just There
@tadast
tadast / countries_codes_and_coordinates.csv
Last active July 3, 2024 06:49
Countries with their (ISO 3166-1) Alpha-2 code, Alpha-3 code, UN M49, average latitude and longitude coordinates
Country Alpha-2 code Alpha-3 code Numeric code Latitude (average) Longitude (average)
Afghanistan AF AFG 4 33 65
Åland Islands AX ALA 248 60.116667 19.9
Albania AL ALB 8 41 20
Algeria DZ DZA 12 28 3
American Samoa AS ASM 16 -14.3333 -170
Andorra AD AND 20 42.5 1.6
Angola AO AGO 24 -12.5 18.5
Anguilla AI AIA 660 18.25 -63.1667
Antarctica AQ ATA 10 -90 0
@jed
jed / how-to-set-up-stress-free-ssl-on-os-x.md
Last active May 31, 2024 18:32
How to set up stress-free SSL on an OS X development machine

How to set up stress-free SSL on an OS X development machine

One of the best ways to reduce complexity (read: stress) in web development is to minimize the differences between your development and production environments. After being frustrated by attempts to unify the approach to SSL on my local machine and in production, I searched for a workflow that would make the protocol invisible to me between all environments.

Most workflows make the following compromises:

  • Use HTTPS in production but HTTP locally. This is annoying because it makes the environments inconsistent, and the protocol choices leak up into the stack. For example, your web application needs to understand the underlying protocol when using the secure flag for cookies. If you don't get this right, your HTTP development server won't be able to read the cookies it writes, or worse, your HTTPS production server could pass sensitive cookies over an insecure connection.

  • Use production SSL certificates locally. This is annoying

@crsantos
crsantos / iosbuildtestflight
Created December 14, 2012 11:10
iOS Build Script With Testflight deployment, exporting .DSYM.zip to ~/Desktop
#!/bin/bash
# Bash script to generate a "Release" Build - Based on arrix.blogspot.com
# - The file must lay on the same .xcodeproj folder
# - Project must be set up with "Debug" (with developer provisioning profiles)
# and "Release" (with distribution provisioning profiles)
# - Project build version will be upgraded with the current datetime and marketing version
# will be the same provided as the second parameter of the script: see USAGE.
#
# USAGE: sh build.sh AppName 0.1.1
@aaronblohowiak
aaronblohowiak / gist:3935007
Created October 22, 2012 22:21
RedisConf Notes Part IV
Redis Pain - Matt @mranney from Voxer (did node-redis)
* Asked to talk about redis stress points.. "no stress, things work for a while and there is no stress and then... you enter a world of pain."
* Pain from how we use it at Voxer. Explanation of Voxer and its use cases.
* People assume Voxer is "how hard can it be?".. "That's how it used to be until we got a bunch of pictures..."
* Growth curve looks like Pinterests "might be the same because there was no label on the y-axis.. might be EXACTLY the same."
* Computers are hard... nothing works as it is supposed to... and eventually you fly into nerd rage and then you become a curmmudgeon... getting serious, this isn't real pain -- we aren't selling stree sheets -- this are great problems to have...
* They use redis as cache for Riak, also for rapidly changing data, "data we can afford to lose", throttling, NO SAVING.
* "We really like redis."
* "When we first started building voxer, I never understood why people use Redis at all... we have a db and .
@aaronblohowiak
aaronblohowiak / gist:3934073
Created October 22, 2012 20:44
RedisConf Notes Part III
Lightning talk: BigCache:
* redis distributed fault-tolerant memory cache as a service (OSS)
* memcache binary protocol compatible
* TCP loadbalanced / consistent hashing algo, ZK for coordination services
* github.com/mercadolibre/bigcache
EvilSha: misadventures in the land of lua. Adam Baldwin: @adam_baldwin
* What can we do that is evil with Redis?
* Listed all functions you have access to in lua in redis; pretty locked-down