Skip to content

Instantly share code, notes, and snippets.

@jpibarra1130
jpibarra1130 / read_workbook.py
Created November 22, 2015 06:18
Sample Python script to read from an excel file.
import xlrd
name = input('file: ')
wb = xlrd.open_workbook(name)
sheet = wb.sheet_by_index(0)
lookup = {
'name': 0,
'website': 1
@jpibarra1130
jpibarra1130 / request.swift
Created March 18, 2015 13:17
Sample request model that can be converted to a MutableURLRequest
class Request {
var url: String
var requestType: RequestType
var body: NSData?
var headers: Dictionary<String, String>?
init(url: String, requestType: RequestType, body: NSData?, headers: Dictionary<String, String>?) {
self.url = url
self.requestType = requestType
@jpibarra1130
jpibarra1130 / kill_tomcat.sh
Created May 2, 2014 07:58
A simple script to kill a running instance of tomcat
#!/bin/sh
PID="$(pgrep -f tomcat-7.0.53-9090)"
echo "Tomcat PID: $PID"
if [ -z "$PID" ]
then
echo 'Tomcat is not running.'
else
@jpibarra1130
jpibarra1130 / vimeo_video_id
Created April 5, 2014 15:48
A simple ruby snippet to retrieve the id for a vimeo url.
# Simple ruby snippet to get the id for a vimeo url. This was based on this gist: https://gist.github.com/wwdboer/4943672
# This should be able to handle the following formats:
# http://vimeo.com/12345
# http://player.vimeo.com/video/12345
# http://player.vimeo.com/video/12345?test=value1
# http://player.vimeo.com/video/12345/?test=value1
# http://vimeo.com/channels/testchannel/12345
# http://vimeo.com/groups/testgroup/videos/1234
def vimeo_id(url)
function get_vimeoid( $url ) {
$regex = '~
# Match Vimeo link and embed code
(?:<iframe [^>]*src=")? # If iframe match up to first quote of src
(?: # Group vimeo url
https?:\/\/ # Either http or https
(?:[\w]+\.)* # Optional subdomains
vimeo\.com # Match vimeo.com
(?:[\/\w]*\/?)? # Optional video sub directory this handles groups links also
\/ # Slash before Id