Skip to content

Instantly share code, notes, and snippets.

@puttin
puttin / Ban Input Methods.lsrules
Created February 11, 2019 05:09
Ban Input Methods
{
"description" : "",
"name" : "Ban Input Methods",
"rules" : [
{
"action" : "deny",
"creationDate" : 1460985349.190908,
"modificationDate" : 1549857179.580241,
"owner" : "me",
"process" : "\/Library\/Input Methods\/BaiduIM.app\/Contents\/MacOS\/BaiduIM",
@puttin
puttin / SSR_subscribe_to_Surge_External.py
Last active March 9, 2024 18:49
parse SSR subscribe to Surge Mac External list
#!/usr/bin/env python3
import sys
import requests
import base64
# https://github.com/shadowsocksr-backup/shadowsocks-rss/wiki/SSR-QRcode-scheme
# usage: $0 https://example.com/list '/usr/local/bin/ss-local'
subscribe_url = sys.argv[1]
exec_path = sys.argv[2]
@puttin
puttin / Gemfile
Last active June 28, 2020 11:19
fetch WWDC HD videos' download links
source 'https://rubygems.org'
gem 'httparty'
gem 'nokogiri'
gem 'pry'
@puttin
puttin / reveal_build_phase.sh
Last active September 18, 2019 13:40
Reveal App build phase
#!/bin/bash
# see also http://support.revealapp.com/kb/getting-started/load-the-reveal-server-via-an-xcode-breakpoint
# remove Debug check; change framework path; simplify
# find original one in Reveal.app
set -e
REVEAL_APP_PATH=$(mdfind kMDItemCFBundleIdentifier="com.ittybittyapps.Reveal2" | sort | head -n 1)
[ ! -e "${REVEAL_APP_PATH}" ] && echo "warning: Reveal Server not loaded: Cannot find a compatible Reveal app." && exit 0
echo "Found Reveal at ${REVEAL_APP_PATH}"
struct RecurrenceRelation<Element>: SequenceType, GeneratorType {
private var prevs: [Element]
private let relat: ([Element], Int) -> Element
private var i: Int = 0
mutating func next() -> Element? {
guard i == prevs.endIndex else { return prevs[i++] }
prevs.append(relat(prevs, i))
prevs.removeAtIndex(0)
@puttin
puttin / Person.m
Last active August 29, 2015 14:19 — forked from janodev/Person.m
#import <objc/runtime.h>
#import <Foundation/Foundation.h>
@interface Person : NSObject
@end
@implementation Person
@end
@interface Person(dynamicProperties)
@puttin
puttin / README.md
Last active December 22, 2015 23:29
Some tools may possibly help you to watch WWDC 2013 videos.

Where Is The Name?

Be careful before you use these tools.

#What's this? what's this?

Some tools may possibly help you to watch WWDC 2013 videos.

@puttin
puttin / genDiff.sh
Created April 19, 2013 07:24
a shell script help me to view code diff on my jailbreak iPad. View more detail on [View code with your iPad and git](http://puttin.github.io/2013/04/18/view-code-with-your-ipad-and-git/)
#!/bin/bash
#default: diff last 2 commit
count=2
#default: check next commit
upordown=1
while getopts "u:d:" arg
do
case $arg in
@puttin
puttin / LineLayout.h
Created April 9, 2013 07:49
An advanced example about the UICollectionView and custom layout NEED QuartzCore.framework
/*
File: LineLayout.h
Abstract: Simple flow layout to lay out items in a line.
Version: 1.0
Disclaimer: IMPORTANT: This Apple software is supplied to you by Apple
Inc. ("Apple") in consideration of your agreement to the following
terms, and your use, installation, modification or redistribution of