Skip to content

Instantly share code, notes, and snippets.

View lexrus's full-sized avatar
🏠
Working from home

Lex Tang lexrus

🏠
Working from home
View GitHub Profile
@lexrus
lexrus / vpn.sh
Last active December 21, 2015 02:49 — forked from alvinl/vpn.sh
#!/bin/bash
#apt-get update
apt-get install pptpd -y --force-yes
echo localip 192.168.240.1 >> /etc/pptpd.conf
echo remoteip 192.168.240.2-200 >> /etc/pptpd.conf
echo ms-dns 8.8.8.8 >> /etc/ppp/pptpd-options
echo ms-dns 8.8.4.4 >> /etc/ppp/pptpd-options
echo "lex pptpd lexrusontwitter *" | tee -a /etc/ppp/chap-secrets
/etc/init.d/pptpd restart
@lexrus
lexrus / uncrustify.cfg
Last active December 21, 2015 13:59
My ~/.uncrustify/uncrustify.cfg for https://github.com/benoitsan/BBUncrustifyPlugin-Xcode
#
# Uncrustify Configuration File
# File Created With UncrustifyX 0.4.3 (252)
#
# Alignment
# ---------
## Alignment
// 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];
}
@lexrus
lexrus / cow.conf
Created December 2, 2013 15:34
/etc/supervisor/conf.d/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
@lexrus
lexrus / dump_edit_page_url_list_in_ios_dev_center.js
Created January 2, 2014 15:43
Dump edit page url list in iOS Dev Center
$.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 / rmsenseless.sh
Last active June 12, 2022 08:41
Remove senseless files from my NAS
#!/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 / WTF_YOU_MUST_UPGRADE_COCOAPODS.sh
Created May 28, 2014 10:34
Force your little brother to upgrade CocoaPods.
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 / chinadns.conf
Created July 23, 2014 02:18
supervisor config for chinadns
[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 / disable_all_animation.sh
Created August 1, 2014 06:05
Disable all animations of OS X.
# 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 / LTLog.h
Last active February 21, 2016 19:56
My DDLog config
//
// 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>