Skip to content

Instantly share code, notes, and snippets.

@zcourts
zcourts / install-zmq-on-osx.sh
Created May 7, 2014
Because the standard install doesn't always work!
View install-zmq-on-osx.sh
cd /tmp
git clone git@github.com:zeromq/zeromq4-x.git
cd zeromq4-x
./autogen.sh
./configure
make
make install
View showspreadsheet.php
<?php
// Parsing this spreadsheet: https://spreadsheets.google.com/pub?key=0Ah0xU81penP1dFNLWk5YMW41dkcwa1JNQXk3YUJoOXc&hl=en&output=html
$url = 'http://spreadsheets.google.com/feeds/list/0Ah0xU81penP1dFNLWk5YMW41dkcwa1JNQXk3YUJoOXc/od6/public/values?alt=json';
$file= file_get_contents($url);
$json = json_decode($file);
$rows = $json->{'feed'}->{'entry'};
foreach($rows as $row) {
echo '<p>';
@andrew
andrew / leaderboard.rb
Last active Dec 10, 2015
Get a leaderboard of contributions in your GitHub organization
View leaderboard.rb
## Contribution leaderboard
#
# Get a leaderboard of contributions in your org
#
# usage: $ USERNAME=yourusername PASSWORD=yourpassword ORG=yourorgname ruby leaderboard.rb
#
# n.b requires the octokit and mechanize gems
require 'rubygems'
require 'octokit'
@Swop
Swop / Screencast to GIF file
Last active Dec 11, 2015
Simple steps to create a GIF from a screencast (OSX but works with Linux)
View Screencast to GIF file
# Install ffmepg (for the screencast) & imagemagick (to optimize the GIF file for web usage)
brew install ffmpeg
brew install imagemagick
# Make the screencast and compress it
ffmpeg -i ScreenFlow.mov -pix_fmt rgb24 output.gif
convert -layers Optimize output.gif output_optimized.gif
# Upload it somewere in the cloud...
# ... and use the file in the desire website. Here's the markdown syntax:
@andrew
andrew / contributions.rb
Last active Dec 12, 2015
Who's done more work on your repo, you or your community?
View contributions.rb
require 'json'
require 'open-uri'
repo = ENV['REPO']
owner = ENV['OWNER'] || repo.match(/(.+)\//)[1]
url = "https://github.com/#{repo}/graphs/contributors-data"
doc = open(url).read
if doc == ' ' # retry if data not loaded
sleep 2
doc = open(url).read
View check_directory_exist.yml
---
# Attempt to check if the folder exist.
# If it exist echo out a string. You have to echo something
# if the directory does exist or else the task is considered failed
# Output is set to $is_default_created. Note that this variable is
# object and not an atomic value.
- name: Attempt to check if a directory exist
action: shell test -d /my/folder && echo "exist" || echo ""
register: is_folder_created
@jgarber
jgarber / gist:5893179
Last active Dec 19, 2015
Setting up motion with a raspberry pi camera
View gist:5893179
ssh-copy-id pi@192.168.X.X
# on the pi
sudo su -
cat <<EOF >> /etc/wpa_supplicant/wpa_supplicant.conf
network={
ssid="Your SSID Here"
proto=RSN
key_mgmt=WPA-PSK
pairwise=CCMP
View gist:ba6b78e24c315a7f5e3c
<?php
/**
* @BeforeScenario
*/
public function captureConsoleLog() {
if (!($this->getSession()->getDriver() instanceof \Behat\Mink\Driver\Selenium2Driver)) {
// Not a Selenium driver (e.g. PhantomJs).
return;
}
View Laravel Controller
<?php
class evidenceController {
public function getDetails($id){
$course = Course::with(['courseType'])
->checkEstablishmentOnView()
->excludeArchived()
->findOrFail($id);
$view = View::make('courses/parts/details')
->with('course', $course);
@fordnox
fordnox / jekins_server.sh
Created Sep 25, 2011
Install Jenkins server on Ubuntu
View jekins_server.sh
#!/bin/sh
sudo apt-get update
sudo apt-get install openjdk-6-jre
sudo apt-get install openjdk-6-jdk
sudo wget -q -O - http://pkg.jenkins-ci.org/debian/jenkins-ci.org.key | sudo apt-key add -
sudo sh -c 'echo deb http://pkg.jenkins-ci.org/debian binary/ > /etc/apt/sources.list.d/jenkins.list'
sudo apt-get update
sudo apt-get install jenkins
sudo apt-get install ant