This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# | |
# A complete URL-shortening web application, written in Ruby/Sinatra. Run it | |
# from the command line, and then visit http://localhost:4567/ | |
# | |
# Or to run it under apache/passenger, you'll need a config.ru file with the | |
# following contents: | |
# | |
# require 'tinyurl' | |
# run Sinatra::Application |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function toJSON(object) { | |
var json = new Array(); | |
for(var index in object) { | |
type = typeof(object[index]); | |
if(type == 'object'){ | |
json.push('"'+index+'":' + toJSON(object[index])); | |
} else if(type == 'string') { | |
json.push('"'+index+'":' + '"'+object[index].replace(/\"/g,'\\"')+'"'); | |
} else if(type == 'boolean' || type == 'number') { | |
json.push('"'+index+'":' +object[index]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns aws.s3 | |
(:refer-clojure :exclude [get]) | |
(:use [clojure.walk :only (keywordize-keys stringify-keys)] | |
[clojure.contrib.def :only (defonce-)] | |
[clojure.contrib.json :only (read-json write-json)]) | |
(:import [java.io PrintWriter InputStreamReader ByteArrayInputStream ByteArrayOutputStream] | |
[java.util.zip GZIPInputStream GZIPOutputStream] | |
[com.google.common.base Charsets] | |
[com.amazonaws.services.s3 AmazonS3Client] | |
[com.amazonaws.services.s3.model Region CreateBucketRequest ObjectMetadata |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<DOCTYPE!> | |
<html> | |
<head> | |
<title>Filtered Search</title> | |
<script type="text/javascript" src="https://raw.github.com/rmcvey/jsper/master/jsper.js"></script> | |
<script type="text/javascript"> | |
window.onload = function(){ | |
var saved = document.getElementById('saved'); | |
jsper.each('filters', function(item){ | |
var element = document.createElement('option'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$mimes = array( | |
'hqx' => 'application/mac-binhex40', | |
'cpt' => 'application/mac-compactpro', | |
'csv' => array('text/x-comma-separated-values', 'text/comma-separated-values', 'application/octet-stream'), | |
'bin' => 'application/macbinary', | |
'dms' => 'application/octet-stream', | |
'lha' => 'application/octet-stream', | |
'lzh' => 'application/octet-stream', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
HOSTSFILE="/etc/hosts" | |
BAKFILE="$HOSTSFILE.bak" | |
DOMAINREGEX="^[a-zA-Z0-9]{1}[a-zA-Z0-9\.\-]+$" | |
IPREGEX="^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$" | |
URLREGEX="^https?:\/\/[a-zA-Z0-9]{1}[a-zA-Z0-9\/\.\-]+$" | |
backup() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mechanize | |
from bs4 import BeautifulSoup | |
from datetime import datetime | |
TGT_DATE = 'MONTH DAY, YEAR' #i.e. 'September 30, 2014' | |
OFFICE_ID = '503' # officeid for SF DMV. See HTML code for other office ids | |
NUMBERITEMS = 'Num' # number of tasks for dmv; should be between 1-3 | |
FIRSTNAME = 'FIRST_NAME' | |
LASTNAME = 'LAST_NAME' | |
# Number looks like (TELAREA) TELPREFIX-TELSUFFIX |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"errors" | |
"flag" | |
"fmt" | |
"io/ioutil" | |
"log" | |
"net" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### | |
### | |
### UPDATE: For Win 11, I recommend using this tool in place of this script: | |
### https://christitus.com/windows-tool/ | |
### https://github.com/ChrisTitusTech/winutil | |
### https://www.youtube.com/watch?v=6UQZ5oQg8XA | |
### iwr -useb https://christitus.com/win | iex | |
### | |
### |
OlderNewer