Skip to content

Instantly share code, notes, and snippets.

//
// KSDIdlingWindow.h
//
// Created by Brian King on 4/13/10.
// Copyright 2010 King Software Designs. All rights reserved.
//
// Based off:
// http://stackoverflow.com/questions/273450/iphone-detecting-user-inactivity-idle-time-since-last-screen-touch
//
@msabramo
msabramo / new_gist.py
Created January 3, 2011 06:42
Take input from stdin and create a new public gist with it
#!/usr/bin/env python
import getpass, mechanize, optparse, os.path, sys
parser = optparse.OptionParser()
parser.add_option('--login')
parser.add_option('--password')
parser.add_option('--filename')
parser.add_option('--description')
parser.add_option('--private', action='store_true', default=False)
@afternoon
afternoon / git-slim.py
Created December 5, 2011 14:42
Remove large objects from a git repository
#!/usr/bin/python
#
# git-slim
#
# Remove big files from git repo history.
#
# Requires GitPython (https://github.com/gitpython-developers/GitPython)
#
# References:
# - http://help.github.com/remove-sensitive-data/
@vertexclique
vertexclique / cracking.md
Last active May 11, 2024 21:17
Cracking guide for Sublime Text 3 Build 3059 / 3065 ( Mac / Win x86_64 / Windows x86 / Linux x64 / Linux x86 )

MacOS

Build 3059

MD5: 59bab8f71f8c096cd3f72cd73851515d

Rename it to: Sublime Text

Make it executable with: chmod u+x Sublime\ Text

@bennythemink
bennythemink / gist:ec7bf376c280b2cf1dd1
Created July 17, 2014 06:02
Small but handy NSString extension for checking if the string is a valid email address or is a valid number
@interface NSString (Extension)
- (BOOL) isAnEmail;
- (BOOL) isNumeric;
@end
@implementation NSString (Extension)
/**
// Capture author info & user status
NSDictionary *articleParams = [NSDictionary dictionaryWithObjectsAndKeys:
@"John Q", @"Author",
@"Registered", @"User_Status",
nil];
[Flurry logEvent:@"Article_Read" withParameters:articleParams];

检查以下文件夹删除不需要的即可以

  • ~/Library/Logs/ (我全删了,没影响)
  • ~/Library/Caches/xxxxx(使用 DaisyDisk 找到容量比较大的删除. 不会对系统有影响)
  • ~/Library/Caches/com.spotify.client(全删, 正常工作)
  • ~/Library/Caches/Google/chrome (全删, 正常工作)
  • /Applications/Google Chrome/Contents/Versions/ (只保留最新的那个文件夹, 其他的删除, 正常工作)
  • ~/Library/Developer/Xcode/DerivedData/ (全删, 正常工作.)

工具:

  • DaisyDisk 使用试用版即可,可直观查看文件(夹)大小.
@ccbikai
ccbikai / unsplash.py
Last active December 31, 2019 12:15
unsplash 全站下载脚本
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
# unsplash 全站下载脚本
# 请先安装 requests ,BeautifulSoup
# pip install requests beautifulsoup4
# 运行 python unsplash.py
# 输入最小页数和最大页数
anonymous
anonymous / default.conf
Created September 29, 2014 06:51
server {
listen 80;
server_name bitcall.org;
root /usr/share/nginx/html;
#charset koi8-r;
# access_log /var/log/nginx/log/host.access.log main;
if (!-e $request_filename) {
rewrite ^([_0-9a-zA-Z-]+)?(/wp-.*) $2 last;
rewrite ^([_0-9a-zA-Z-]+)?(/.*.php)$ $2 last;
rewrite ^ /index.php last;
@Zulko
Zulko / 3D_piano_from_midi.py
Last active April 9, 2024 05:51
Turn a piano MIDI file into a basic 3D animated piano video.
"""
Turn a piano MIDI file into a basic 3D animated piano video.
See the result here:
I am leaving it as a script because it is not tested on enough MIDI files yet.
Zulko 2014
This script is released under a Public Domain (Creative Commons 0) licence.