Skip to content

Instantly share code, notes, and snippets.

Christian Genco christiangenco

Block or report user

Report or block christiangenco

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
christiangenco / videos.js
Created Mar 28, 2012 — forked from csabapalfi/videos.js
Download and Organize Coursera videos
View videos.js
var sectionName = $(this).text().replace(/Chapter .+ - /,"").replace(/\:/,'-').replace(/^(V|I|X)+\. /,'');
var $lectureLink = $(this);
var videoName = $.trim($lectureLink.text());
var downloadLink = $lectureLink.attr('href').replace('view','download.mp4');
var cookieHeader = ' --header \"Cookie:'+ document.cookie + '\" ';
var directory = (sectionIndex+1) + '. ' + sectionName + '/';
var filename = directory + (videoIndex+1) + '. ' + videoName + '.mp4';
christiangenco / gist:2240229
Created Mar 29, 2012
GoogleCL Calendar add shortcut: `gcal Party Today`
View gist:2240229
function gcal {google calendar add "`echo $@`"}
christiangenco / csv_to_json.rb
Created May 24, 2012
Translate .csv files to .json objects using the first line of the csv file as a list of keys
View csv_to_json.rb
# csv_to_json.rb
# a simple utility to translate csv files to json objects
# using the first line of the csv file as a list of keys
# The keys in the first line of the csv file are downcased and
# underscored (ex: "First Name" => "first_name")
# Example usage:
# csv_to_json.rb my_csv_file.csv
# => outputs JSON interpretation of my_csv_file.csv to STDOUT
christiangenco / weight.rb
Created May 1, 2013
A simple script to log my weight in a csv stored in dropbox.
View weight.rb
#!/usr/bin/env ruby
require 'time'
filename = '/Users/cgenco/Dropbox/log/weight.csv', "a") {} # create the file if it doesn't exist
weight = ARGV.first
unless weight
puts "From: " + filename
christiangenco / serial_vibrating_belt.ino
Created Aug 23, 2013
Arduino and ruby code for The Vibrating Belt. More information can be found at:
View serial_vibrating_belt.ino
#simplest ruby program to read from arduino serial,
#using the SerialPort gem
# from
require 'serialport'
require 'pry'
# require 'em-websocket'
View factors.rb
require 'pry'
class Integer
def factors() (1...self).select { |n| (self % n).zero? } end
class Array
def score(n)
total = n
minus = n.factors.inject(0) {|sum, f|
View www to main redirect in nginx
server {
listen 80;
rewrite ^/(.*)$1 permanent;
christiangenco / coffify
Last active Dec 28, 2015
Convert .js files to .coffee files in batch.
View coffify
#!/usr/bin/env ruby
# Usage:
# $ coffify app/*/*
# Depends on
# npm install js2coffee
# skip this file if it's not a .js file
christiangenco / bitcoin_address_validator.rb
Last active Jan 2, 2016 — forked from alexandrz/bitcoin_address_validator.rb
Simple Rails bitcoin address validation. Doesn't calculate the checksum or anything fancy - just checks that the address starts with a 1 or 3, consists only of alphanumeric characters, and is 27-34 characters long (from
View bitcoin_address_validator.rb
class User < ActiveRecord::Base
validates :bitcoin_address, format: { with: /\A(1|3)[a-zA-Z1-9]{26,33}\z/,
message: "invalid bitcoin address" }
christiangenco / download website assets
Created Jan 20, 2014
Use wget to download a website's assets, including images, css, javascript, and html. From
View download website assets
$ wget \
--recursive \
--no-clobber \
--page-requisites \
--html-extension \
--convert-links \
--domains \
--no-parent \
You can’t perform that action at this time.