Skip to content

Instantly share code, notes, and snippets.

View ziggear's full-sized avatar
😀
Enjoy opensource

Ziggear ziggear

😀
Enjoy opensource
  • Some Company
  • Earth
View GitHub Profile
#fw:http://www.techiecorner.com/35/how-to-flush-dns-cache-in-linux-windows-mac/
#windows
ipconfig /flushdns
#linux
/etc/rc.d/init.d/nscd restart
#Mac OS X Leopard
lookupd -flushcache
#fw:http://www.macworld.com/article/1157370/applescriptsystempreferences.html
#AppleScript
#Filename: ToggleSharing.scpt
tell application "System Preferences"
activate
end tell
tell application "System Events"
tell process "System Preferences"
// Created by ziggear on 13-5-26
// fw & courtesy: http://cocoasamurai.blogspot.com/2011/04/singletons-your-doing-them-wrong.html
// usage:
// @implementation SomeClass
// ....
// kSingletonSynthesize(SomeClass)
// @end
//Thread-safe block
#define kRunInSecurutyBlock(lines) static dispatch_once_t pred; dispatch_once(&pred, ^{ \
plutil -p xml1 Info.plist | grep "BundleName" | sed 's/ "\(.*\)" => "\(.*\)"/\2/'
plutil -p xml1 Info.plist | grep "BundleShortVersionString" | sed 's/ "\(.*\)" => "\(.*\)"/\2/'
plutil -p xml1 Info.plist | grep "BundleDisplayName" | sed 's/ "\(.*\)" => "\(.*\)"/\2/'
plutil -p xml1 Info.plist | grep "BundleIdentifier" | sed 's/ "\(.*\)" => "\(.*\)"/\2/'
NSDictionary *dict = ...
...
for (NSString *key in dict) {
NSString *value = [dict objectForKey:key];
...
}
//LuaJIT on iOS 5.1
Lua SciMark 2010-12-10 based on SciMark 2.0a. Copyright (C) 2006-2010 Mike Pall.
FFT 4.76 [1024]
SOR 12.18 [100]
MC 2.94
SPARSE 7.84 [1000, 5000]
LU 10.60 [100]
SciMark 7.67 [small problem sizes]
@ziggear
ziggear / gist:8002951
Created December 17, 2013 10:35
wp result
(
{
"comment_status" = open;
"custom_fields" = (
);
guid = "http://www.ziggear.us/?p=1";
link = "http://www.ziggear.us/?p=1";
"menu_order" = 0;
"ping_status" = open;
"post_author" = 1;
@ziggear
ziggear / gist:8084951
Last active January 1, 2016 03:19
Adblock script for Weibo
weibo.com##DIV[class="WB_feed_type SW_fun S_line2 type_spe"]
weibo.com##DIV[class="WB_feed_type SW_fun W_no_border S_line2"]
weibo.com##DIV[class="key S_textb"]
weibo.com##DIV[class="W_tips tips_error clearfix"]
weibo.com##DIV[class="WB_feed_together S_line1 S_bg1"]
weibo.com##DIV[id="pl_rightmod_noticeboard"]
weibo.com##DIV[id="trustPagelet_recom_memberv5"]
weibo.com##DIV[id="pl_leftnav_app"]
weibo.com##DIV[id="trustPagelet_indexright_recom"]
@ziggear
ziggear / gist:8251551
Created January 4, 2014 04:10
my sqlite scripts
-- select hunman readable time from a unix timestamp
select
latitude,longitude,datetime(time / 1000, 'unixepoch', 'localtime') as time
from UploadedGPSPoints order by -time;
@ziggear
ziggear / gist:8412680
Created January 14, 2014 03:44
weibo fixer hand-script
<!-- 让个人首页内容等宽居中 -->
<div class="W_main_c" style="left:50%; top:50%; width:auto;">