Skip to content

Instantly share code, notes, and snippets.

View gcollazo's full-sized avatar

Giovanni Collazo gcollazo

View GitHub Profile
@joegoggins
joegoggins / install and add gcc arm to PATH.sh
Last active October 2, 2024 14:24
How I installed GCC ARM on my Mac 10.9 Mac Book Pro
# Download the file manually from here https://launchpad.net/gcc-arm-embedded
# Note: `curl` command doesn't work
# I downloaded this one: "gcc-arm-none-eabi-4_7-2013q3-20130916-mac.tar.bz2"
# double click it to unzip it
# Make a place to install it to
mkdir /usr/local/gcc_arm
# Move the unzipped stuff there.
@wsargent
wsargent / docker_cheat.md
Last active June 29, 2024 19:32
Docker cheat sheet
// animated route transition workaround for ember
// this workaround only deals with the current view
// if you need to animate the new and the old view in parallel this won't help you.
App.ApplicationRoute = Ember.Route.extend({
actions: {
willTransition: function(transition){
if(!this.isInTransition){
// stop transition until animation is complete
@gcollazo
gcollazo / gist:6280084
Created August 20, 2013 11:04
Bootstrap 3 media queries
xs = "(min-width: 0px) and (max-width: 767px)"
sm = "(min-width: 768px) and (max-width: 991px)"
md = "(min-width: 992px) and (max-width: 1199px)"
lg = "(min-width: 1200px)"

Displaying images in the terminal with tput and echo

output

Requires ImageMagick, easily available from your favorite package manager. Tested on Linux and OSX
convert image.png -resize 40 txt:-|sed -E 's/://;s/\( ? ?//;s/, ? ?/,/g;s/\)//;s/([0-9]+,[0-9]+,[0-9]+),[0-9]+/\1/g;s/255/254/g;/mage/d'|awk '{print $1,$2}'|sed -E 's/^0,[0-9]+ /print "echo;tput setaf "\;/;s/^[0-9]+,[0-9]+ /print "tput setaf ";/;s/(.+),(.+),(.+)/\1\/42.5*36+\2\/42.5*6+\3\/42.5+16/'|bc|sed 's/$/;echo -n "  ";/'|tr '\n' ' '|sed 's/^/tput rev;/;s/; /;/g;s/$/tput sgr0;echo/'|bash
@jpadilla
jpadilla / .python-startup.py
Last active April 7, 2018 16:17
export PYTHONSTARTUP=$HOME/.python-startup.py
import os
import readline
import rlcompleter
import atexit
history_file = os.path.join(os.environ['HOME'], '.python_history')
try:
readline.read_history_file(history_file)
except IOError:
@sspross
sspross / DJANGO_TWISTED_HAPROXY.md
Last active November 13, 2023 03:15
Serving Django and Twisted using HAproxy

Serving Django and Twisted using HAproxy

Why?

Because we wanted to achive the following while developing a webapp using websockets:

Static serving (nginx), Django application (gunicorn) and Websockets service (twisted)

  • on the same IP
@jpadilla
jpadilla / source.js
Last active December 14, 2015 02:49
Blimp Selenium IDE Python 2 / unittest / WebDriver
/*
* Formatter for Selenium 2 / WebDriver Python client.
*/
var subScriptLoader = Components.classes["@mozilla.org/moz/jssubscript-loader;1"].getService(Components.interfaces.mozIJSSubScriptLoader);
subScriptLoader.loadSubScript('chrome://selenium-ide/content/formats/webdriver.js', this);
function testClassName(testName) {
return testName.split(/[^0-9A-Za-z]+/).map(
function(x) {
@cobyism
cobyism / gh-pages-deploy.md
Last active April 12, 2025 09:10
Deploy to `gh-pages` from a `dist` folder on the master branch. Useful for use with [yeoman](http://yeoman.io).

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@Nurdok
Nurdok / python_conversion.md
Last active February 5, 2025 05:47
Python Conversion

Python Number Conversion Chart

From To Expression