Skip to content

Instantly share code, notes, and snippets.

#!/bin/sh
if [ $UID -ne 0 ]; then
echo "\033[31mSuperuser privileges are required to run this script.\033[0m"
echo "e.g. \"\033[33msudo\033[0m $0\""
exit 1
fi
driver=AX88179_178A.kext
driver_path=/Library/Extensions/$driver
http://devstreaming.apple.com/videos/wwdc/2014/403xxksrj0qs8c0/403/403_hd_intermediate_swift.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/419xxli6f60a6bs/419/419_hd_advanced_graphics_and_animation_performance.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/101xx36lr6smzjo/101/101_hd.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/236xxwk3fv82sx2/236/236_hd_building_interruptible_and_responsive_interactions.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/306xxjtg7uz13v0/306/306_hd_javascript_for_automation.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/404xxdxsstkaqjb/404/404_hd_advanced_swift.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/701xx8n8ca3aq4j/701/701_hd_designing_accessories_for_ios_and_os_x.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/224xxxlsvigdoc0/224/224_hd_core_os_ios_application_architectural_patterns.mov?dl=1
http://devstreaming.apple.com/videos/wwdc/2014/717xxux5eg6f9v4/717/717_hd_kids_and_apps.mov?dl=1
http://devstreaming.ap
@venj
venj / down.rb
Last active August 29, 2015 14:03
#!/usr/bin/env ruby
# Will download to Files in current directory.
# To download:
# ruby down.rb
require "open-uri"
require "fileutils"
include FileUtils
USER = "data_public"
@venj
venj / UIColorExtra.swift
Last active August 29, 2015 14:04
A UIColor Extension to parse Hex string(for CSS and for KML) to color. Code works for Xcode 6 Beta 5. Based on https://github.com/yeahdongcn/UIColor-Hex-Swift/blob/master/UIColorExtension.swift
import UIKit
extension UIColor {
convenience init(kmlColorString:String) {
var scanner = NSScanner(string:kmlColorString)
var color:UInt32 = 0;
scanner.scanHexInt(&color)
let mask:UInt32 = 0x000000FF
var a = color >> 24 & mask
#!/usr/bin/env xcrun swift
import Foundation
if NSFoundationVersionNumber < 1139.1 {
println("You need Xcode6-DP5 and up to run this script")
exit(1)
}
let args = Process.arguments
@venj
venj / toupiao.rb
Last active August 29, 2015 14:11
#!/usr/bin/env ruby
require "open-uri"
ARGV[0].to_i.times {|i| open "http://www.sh-anfang.org/expert/expert.asp?tp=5&id=5"; puts "已刷#{i + 1}票。" }
puts "完成"
# One-liner:
# ruby -ropen-uri -e "2.times {|i| open 'http://www.sh-anfang.org/expert/expert.asp?tp=5&id=5'; puts \"已刷#{i + 1}票。\" };puts '完成' "
@venj
venj / string_extension.cs
Created January 27, 2015 12:41
Class extension syntax for C#
namespace System
{
public static class StringExtension
{
public static string TimesMe(this String str, int times)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < times; i++)
{
@venj
venj / vcext.snippet
Created January 27, 2015 13:24
Code Snippet for visual studio to generate class extension template. Trigger: vcext<TAB><TAB>
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>Class Extension</Title>
<Shortcut>vcext</Shortcut>
<Description>Add Method To Existing Class With Extension</Description>
<Author>Venj Chu</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
@venj
venj / cs.txt
Created February 21, 2015 07:32
venj@Wairy ~ $ diskutil cs list
CoreStorage logical volume groups (1 found)
|
+-- Logical Volume Group 737A11E0-E197-423D-BA97-01E8155B55C1
=========================================================
Name: Macintosh HD
Status: Online
Size: 120473067520 B (120.5 GB)
Free Space: 18948096 B (18.9 MB)
|
@venj
venj / detect.rb
Last active August 29, 2015 14:16
A script to detect referb iPad mini 2 availablility in China.
#!/usr/bin/env ruby
# encoding = UTF-8
require "open-uri"
begin
require 'mailx' # Or main for *nix
rescue LoadError => e
STDERR.puts "Please install mail gem first."
exit 1
end