Skip to content

Instantly share code, notes, and snippets.

View tgittos's full-sized avatar
🤖
working on the robot apocalypse

Tim Gittos tgittos

🤖
working on the robot apocalypse
View GitHub Profile

Keybase proof

I hereby claim:

  • I am tgittos on github.
  • I am tgittos (https://keybase.io/tgittos) on keybase.
  • I have a public key ASDWAWcwsB4hXfttqTgleDDUv40vO_yAoSqhtdizTbBDrwo

To claim this, I am signing this object:

@tgittos
tgittos / hate.js
Created April 4, 2017 17:33
Why I hate Javascript
// Dumb date handling across browsers
// Chrome:
new Date('2017-4-3')
// Mon Apr 03 2017 00:00:00 GMT-0500 (CDT)
// Firefox
new Date('2017-4-3')
// Date 2017-04-03T00:00:00.000Z
// Dumb type handling
@tgittos
tgittos / .vimrc
Created November 20, 2015 03:02
Compiling in vim using build.bat
function! s:build()
let &makeprg='build'
silent make
botright copen
wincmd p
endfunction
command! Build call s:build()
set switchbuf=useopen,split
nnoremap <silent> <F8> :Build<CR>
@tgittos
tgittos / simple_server.rb
Created June 15, 2015 20:31
Basic C-style web server in Ruby
#! /usr/bin/env ruby
require 'socket'
include Socket::Constants
PORT = 8888
HOST = '0.0.0.0'
socket = Socket.new(AF_INET, SOCK_STREAM, 0)
address = Socket.pack_sockaddr_in(PORT, HOST)
@tgittos
tgittos / pinterest-watir.rb
Last active August 29, 2015 14:17
Use Ruby and Watir-Webdriver to scrape pins from a Pinterest page.
#! /usr/bin/env ruby
require 'watir-webdriver'
require 'openssl'
require 'open-uri'
require 'nokogiri'
# bad pinterest, having a bad cert
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE
@tgittos
tgittos / dAScraper.py
Last active August 29, 2015 14:01
deviantArt RSS scraper
#! /usr/bin/env python
import sys
import feedparser
import urllib
import os
import pickle
import time
import datetime
@tgittos
tgittos / leap-year.rb
Created March 2, 2011 19:49
Determine if a given year is a leap year
def is_leap_year?
(year % 4 == 0) and ((year % 100 > 0) or (year % 100 == 0) and (year % 400 == 0))
end
@tgittos
tgittos / concatenate-pdf
Created February 28, 2011 19:55
Concatenates n pdf files into one. First input is the output file, rest of inputs are input files in order.
#! /bin/sh
# Use Ghostscript to concatenate PDF files
output=$1
shift
input=$@
gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$output $input
@tgittos
tgittos / remove-all-gems.rb
Created February 17, 2011 16:21
Removes all Rubygems installed
#! /usr/bin/env ruby
`gem list | cut -d" " -f1 | sudo xargs gem uninstall -aIx`
@tgittos
tgittos / install
Created February 17, 2011 05:26
Install the basics for running Ruby on Rails apps via rvm, nginx and clustered thin servers
#! /bin/bash
# Check we are root first
if [[ ! "root" = "$(whoami)" ]] ; then
echo -e "Please re-run as root." && exit 1
fi ; clear
# RVM dependencies
echo -e "Installing build essential and required dependencies"
sudo apt-get install -y build-essential libreadline5-dev libssl-dev bison libz-dev zlib1g zlib1g-dev libxml2 libxml2-dev libxslt-dev libssl-dev openssl libreadline-dev g++