Skip to content

Instantly share code, notes, and snippets.

@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
@d1rtym0nk3y
d1rtym0nk3y / Ant.sublime-build
Created February 7, 2012 14:16
SublimeText2 Ant build config
// save this as /Users/%user%/AppData/Roaming/Sublime Text 2/Packages/User/Ant.sublime-build
// on windows, or somewhere else on mac/linux
// make sure its "ant.bat" or it will moan about file not found
{
"cmd": ["ant.bat", "-f", "build.xml", "-DBUILD_HOST=local", "main"],
"working_dir": "$project_path"
}
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@lmatteis
lmatteis / gist:2507155
Created April 27, 2012 07:52
JSON.parse() not working correctly in Rhino?

Here's the JSON I'm trying to parse:

`{"Name of submitting scientist":" Eva Weltzien","Institution":"ICRISAT Bamako","Language of submission (only in ISO 2 letter codes)":{"english":"En","french":"Fr"},"Date of submission":"11/23/2011","Crop":"Sorghum","Name of Trait":{"english":"Grain covering","french":"Couverture du Grain"},"Abbreviated name ":{"english":"GRNCOV","french":"CvGr"},"Trait ID for modification, Blank for New":{"english":"CO_324:0000043","french":""},"Description of Trait":{"english":"Amount of grain covered by glumes","french":"Observation Visuelle du degr\u00e9 de couverture du grain par les glumes \u00e0 la maturit\u00e9"},"How is this trait routinely used?":{"english":"Nursery","french":"P\u00e9pini\u00e8re"},"Trait Class":"Morphological","Name of method":{"english":"Grain Covering","french":"Ouverture des glumes"},"Describe how measured (method)":{"english":"Visual observation of the recovery level of grain by the glumes at maturity to give a score","french":"Observation visuelle du niv

@deanputney
deanputney / giffer.sh
Created August 23, 2012 04:39
Giffer - Make gifs from any video
#!/bin/bash
# Installation:
#
# Get yourself ffmpeg and imagemagick.
# brew install ffmpeg
# brew install imagemagick
#
# I put this script at ~/script/giffer.sh and aliased it to giffer.sh
# alias giffer=/Users/<your_username>/scripts/giffer.sh
@benjamine
benjamine / alias.cmd
Last active February 19, 2024 15:49
Aliases for windows command line
::
:: Aliases for windows command line
::
:: Installation:
::
:: - create a folder for your aliases (eg: ```c:\cmd-aliases```)
:: - add that folder to your PATH variable
:: - save this script as setalias.cmd on that folder
:: - run "alias" to see usage
::
@bhubbard
bhubbard / .htaccess
Last active December 25, 2023 02:59
This is my template .htaccess file for WordPress on Cloud Sites.
# Apache Server Config | MIT License
# https://gist.github.com/bhubbard/6082577
# Modified from https://github.com/h5bp/server-configs-apaches
# ##############################################################################
# # Default WordPress #
# ##############################################################################
# http://randomtype.ca/blog/the-wordpress-htaccess-file-explained/
# BEGIN WordPress
@hlung
hlung / How to connect a PS3 controller.md
Last active March 25, 2024 14:45
How to connect PS3 controller on Mac OSX, PC

How to connect PS3 controller on Mac OSX, PC, etc.

This is how you connect PS3 controller to Mac OSX, PC, etc. when previously connected to a PS3. You will need a Mini USB cable. Overcome your laziness, get up of your chair, and go get one!

A big misconception is that keep holding PS button will reset the controller's pairing. It DOES NOT! From my testings, the controller keeps paring with the last machine it was CONNECTED VIA A USB CABLE.

Here are the steps:

@alienresident
alienresident / video-fix-videos-for-pseudo-streaming.md
Last active April 20, 2024 05:02
How to: Fix pseudo-streaming videos by moving Moov Atom
How to:

Fix pseudo-streaming videos by moving Moov Atom

Relies on some *nix CLI utilities: mediainfo; and qt-faststart (part of ffmpeg). I used homebrew to install them on OS X.

What is pseudo-streaming?

Pseudo streaming is simply a video that can start playing before it's fully dowmloaded. The videos are not streaming but rather progressively downloaded. What's important is that the file metadata (the Moov Atom) is at the start of the file rather than at the end. Usually this is an option set when encoding the file (called quick start or web start). If the files have not been encoded this way you can either re-encode or use a utility to move the Moov Atom. Re-encoding takes much longer than using a utility to move the Moov Atom so here's how to do it.

Steps

First check with mediainfo to see if video 'is streamable':

# requires imagemagick and ffmpeg (tested with latest versions)
# make sure you set an INFILE variable first
# get GIF info
video=$(ffmpeg -i "$INFILE" 2>&1 /dev/null | grep "Video:");
# get GIF Frames per second
fps=$(echo "$video" | sed -n "s/.* \([0-9.]*\) fps.*/\1/p");
# a convinience variable so we can easily set FPS on the video