Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Lex Tang lexrus

🏠
Working from home
Block or report user

Report or block lexrus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lexrus
lexrus / com.shadowsocks.chinadns.plist
Last active May 31, 2018
LaunchCtl plist of ChinaDNS for El Capitan.
View com.shadowsocks.chinadns.plist
<?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>
<key>Label</key>
<string>com.shadowsocks.chinadns</string>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/chinadns</string>
<string>-c</string>
@lexrus
lexrus / LTLog.h
Last active Feb 21, 2016
My DDLog config
View LTLog.h
//
// LTLog.h
//
// Created by Lex on 6/29/14.
// Copyright (c) 2014 LexTang.com. All rights reserved.
// https://gist.github.com/lexrus/8c6414e7c0177e9e66ea
//
#import <Foundation/Foundation.h>
@lexrus
lexrus / disable_all_animation.sh
Created Aug 1, 2014
Disable all animations of OS X.
View disable_all_animation.sh
# opening and closing windows and popovers
defaults write -g NSAutomaticWindowAnimationsEnabled -bool false
# smooth scrolling
defaults write -g NSScrollAnimationEnabled -bool false
# showing and hiding sheets, resizing preference windows, zooming windows
# float 0 doesn't work
defaults write -g NSWindowResizeTime -float 0.001
@lexrus
lexrus / chinadns.conf
Created Jul 23, 2014
supervisor config for chinadns
View chinadns.conf
[program:chinadns]
command=/usr/local/bin/chinadns
numprocs=1
autostart=true
autorestart=unexpected
startsecs=2
startretries=3
stdout_logfile=/var/log/chinadns.log
stdout_logfile_maxbytes=2MB
stderr_logfile=/var/log/chinadns.error.log
@lexrus
lexrus / WTF_YOU_MUST_UPGRADE_COCOAPODS.sh
Created May 28, 2014
Force your little brother to upgrade CocoaPods.
View WTF_YOU_MUST_UPGRADE_COCOAPODS.sh
NEW_VER="0.33.1"
POD_VER=`pod --version 2>/dev/null`|| POD_VER=`~/.rbenv/shims/pod --version 2>/dev/null`
if [[ "$POD_VER" != *$NEW_VER ]]; then
echo "error: WTF! You MUST upgrade cocoapods!!!"
exit 1
fi
@lexrus
lexrus / rmsenseless.sh
Last active Jun 20, 2019
Remove senseless files from my NAS
View rmsenseless.sh
#!/bin/bash
find . -name '*.DS_Store' -type f -delete;
find . -name 'Thumbs.db' -type f -delete;
find . -name '*.swp' -type f -delete;
find . -name '*.AppleDouble' -exec rm -rf {} \;
find . -name ".AppleDouble" -print0 | xargs -0 rm -rf;
find . -name ".TemporaryItems" -print0 | xargs -0 rm -rf;
find . -name ".Trashes" -print0 | xargs -0 rm -rf;
find . -name ".afpdeleted*" -print0 | xargs -0 rm -rf;
@lexrus
lexrus / dump_edit_page_url_list_in_ios_dev_center.js
Created Jan 2, 2014
Dump edit page url list in iOS Dev Center
View dump_edit_page_url_list_in_ios_dev_center.js
$.post(profileDataURL, function(d){d.provisioningProfiles.map(function(o){console.log('https://developer.apple.com/account/ios/profile/profileEdit.action?type=&provisioningProfileId='+o.provisioningProfileId)})});
@lexrus
lexrus / cow.conf
Created Dec 2, 2013
/etc/supervisor/conf.d/cow.conf
View cow.conf
[program:cow]
command=/usr/local/bin/cow -err=true -rc="/root/.cow/rc"
numprocs=1
directory=/root/.cow
autostart=true
autorestart=unexpected
startsecs=2
startretries=3
stdout_logfile=/var/log/cow.log
stdout_logfile_maxbytes=2MB
View ios7backButtonBackground.m
// Fixed iOS 7 backButtonBackground issue.
// http://stackoverflow.com/questions/18617522/back-button-is-not-visible-in-ios-7/18950658#18950658
if ([[UIDevice currentDevice].systemVersion compare:@"7.0" options:NSNumericSearch] != NSOrderedAscending) {
[[UINavigationBar appearance] setTintColor:[UIColor whiteColor]];
[[UINavigationBar appearance] setBackIndicatorImage:[UIImage imageNamed:@"BackButtonIcon"]];
} else {
UIImage *backButtonBackground = [[UIImage imageNamed:@"BackButtonIcon"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 29, 0, 0)];
[[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonBackground forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];
}
View uncrustify.cfg
#
# Uncrustify Configuration File
# File Created With UncrustifyX 0.4.3 (252)
#
# Alignment
# ---------
## Alignment
You can’t perform that action at this time.