Skip to content

Instantly share code, notes, and snippets.

@venj
venj / replace-alias-with-link.rb
Created April 22, 2012 09:40
replace aliases with soft links for command line use [ Finder treats links and aliases the same? ]
@venj
venj / me.venj.mount-hdd-rw.plist
Created April 22, 2012 08:05
mount second hdd noowners
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>me.venj.mount-hdd-rw</string>
<key>ProgramArguments</key>
<array>
<string>mount</string>
@venj
venj / epubshare_spider.rb
Created February 11, 2012 05:04
Fetch download links from epubshare.com
#!/usr/bin/env ruby
require "rubygems"
require "open-uri"
require "hpricot"
website = "http://www.epubshare.com"
base_uri = "#{website}/page/"
mainpage_index = 1
file = File.open("links.txt", "w+")
@venj
venj / torrent_spider.rb
Last active September 30, 2015 12:27
!!!!!DEPRECATED!!!!! Tracking the changes to the website is FUCKING BORING!!!! Torrent spider. Hard to maintain...Damn it, always changes web page...
#!/usr/bin/env ruby
# Download torrents from SOME WEBSITE.
require "rubygems"
require "open-uri"
require "hpricot"
require "uri"
require "colorize"
require 'uri'
require 'net/http'
@venj
venj / ExampleClass.m
Created February 7, 2012 09:10 — forked from lukeredpath/ExampleClass.m
Macro for creating your "shared instance" using GCD
@implementation MySharedThing
+ (id)sharedInstance
{
DEFINE_SHARED_INSTANCE_USING_BLOCK(^{
return [[self alloc] init];
});
}
@end
@venj
venj / down_video.rb
Created February 6, 2012 16:43
This is a script that helps you download any apple keynote presentation on http://www.apple.com/apple-events/. You can copy any of the keynote broadcast link, pick a resolution and feed to this script, this script will help you download the stream video.
#!/usr/bin/env ruby
#
# Name: Apple keynote stream video downloader
# Author: venj<i[AT]venj.me>
# Date: 2012-09-13
#
# Description:
# This script helps you download apple keynote stream video on
# http://www.apple.com/apple-events/. Video format is TS.
#
@venj
venj / inject.sh
Created December 31, 2011 14:21
Inject F-Script to a named process. This script is based on the Inject F-Script service. Kinda useful when some apps do not provide the standard services menu.
#!/bin/bash
usage() {
echo Usage: `basename $0` Process_Name
}
if [ $# -ne 1 ]; then
usage
exit 1
fi
@venj
venj / me.venj.checkiPhone.plist
Created November 4, 2011 15:00
Use this plist to set up launchd scheduled task to run this script: https://gist.github.com/1339272
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<!-- Contains a unique string that identifies your daemon to launchd.
This key is required. -->
<key>Label</key>
<string>me.venj.checkiPhone</string>
@venj
venj / check_iphone4s.rb
Created November 4, 2011 13:03
Check iPhone 4s availability in HK and China.
#!/usr/bin/env ruby
# encoding = UTF-8
#
# This script requires following gems:
# - Hpricot
# - growl (Please build it from latest github source code)
#
# And of course, you need a Mac and Growl.
#
#
@venj
venj / down_celebrating_steve.rb
Created October 24, 2011 02:22
Download "A Celebration of Steve's Life" from apple. http://events.apple.com.edgesuite.net/10oiuhfvojb23/event/index.html This script is based on previous WWDC keynote download script: https://gist.github.com/1012426
#!/usr/bin/env ruby
require 'open-uri'
if ["--help", "help", "-h"].include?(ARGV[0]) || ARGV.size < 1
puts "Usage: #{File.basename __FILE__} ( 540p | 540i | 360p | 360i | 360is | 224p )"
exit 0
end
size_hash = {"540p" => "2540", "540i" => "1840", "360p" => "1240", "360i" => "0640", "360is" => "0440", "224p" => "0240"}
video_size = size_hash[ARGV[0]]