Skip to content

Instantly share code, notes, and snippets.

View mackjoner's full-sized avatar

Funbeta mackjoner

View GitHub Profile
#!/usr/bin/env zsh
local LAMBDA="%(?,%{$fg_bold[green]%}λ,%{$fg_bold[red]%}λ)"
if [[ "$USER" == "root" ]]; then USERCOLOR="red"; else USERCOLOR="yellow"; fi
# Git sometimes goes into a detached head state. git_prompt_info doesn't
# return anything in this case. So wrap it in another function and check
# for an empty string.
function check_git_prompt_info() {
if git rev-parse --git-dir > /dev/null 2>&1; then
@mackjoner
mackjoner / sublime_text3_crack.md
Created February 15, 2016 03:32 — forked from sublime-crack4/sublime_text3_crack.md
Sublime Text crack 3103 3083 Win64 Win32 Linux64 Linux32 OSX Mac MacOS latest

cat

To pupils: all binaries can be downloaded http://pan.baidu.com/s/1ntCChyp

After overwriting, maybe need to run chmod +x /path/to/sublime_text. For linux default installation, need to add sudo.

For programmers:

@mackjoner
mackjoner / tmux.conf
Created February 23, 2016 10:05 — forked from spikegrobstein/tmux.conf
my tmux config (updated for 2.1)
# This requires tmux 2.1. a lot of these settings will error on anything earlier.
# Act like Vim; use h,j,k,l to select panes and move the cursor
set-window-option -g mode-keys vi
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
bind-key l select-pane -R
# Look good
@mackjoner
mackjoner / setenv.sh
Created February 26, 2016 03:56 — forked from terrancesnyder/setenv.sh
./setenv.sh - example setenv.sh with defaults set for minimal time spent in garbage collection
#! /bin/sh
# ==================================================================
# ______ __ _____
# /_ __/___ ____ ___ _________ _/ /_ /__ /
# / / / __ \/ __ `__ \/ ___/ __ `/ __/ / /
# / / / /_/ / / / / / / /__/ /_/ / /_ / /
#/_/ \____/_/ /_/ /_/\___/\__,_/\__/ /_/
# Multi-instance Apache Tomcat installation with a focus
# on best-practices as defined by Apache, SpringSource, and MuleSoft
@mackjoner
mackjoner / mailer.py
Created March 4, 2016 04:00 — forked from dbieber/mailer.py
Send an email through Gmail programmatically using Python's smtplib. Code modified from http://kutuma.blogspot.com/2007/08/sending-emails-via-gmail-with-python.html
#!/usr/bin/python
# Adapted from http://kutuma.blogspot.com/2007/08/sending-emails-via-gmail-with-python.html
import getpass
import smtplib
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email import Encoders
import os
@mackjoner
mackjoner / mysql_uninstall.txt
Created March 28, 2016 02:19 — forked from ismaild/mysql_uninstall.txt
uninstall mysql, Mac OSX
1. Backup any databases you have using mysqldump
2. Stop MySQL using the pref panel
3. Open Terminal and type in the following commands
4. sudo rm /usr/local/mysql
5. sudo rm -rf /usr/local/mysql*
6. sudo rm -rf /Library/StartupItems/MySQLCOM
7. sudo rm -rf /Library/PreferencePanes/My*
8. edit /etc/hostconfig and remove the line MYSQLCOM=-YES- (May not be necessary)
9. rm -rf ~/Library/PreferencePanes/My*
10. sudo rm -rf /Library/Receipts/mysql*
@mackjoner
mackjoner / py.py
Created April 18, 2016 08:36
python interview questions
# encoding: utf8
# 什么是lambda函数?它有什么好处?另外python在函数式编程方面提供了些什么函数和语法?
# - lambda 就是匿名函数
# - 好处: 可以动态生成一个函数对象,不用给这个对象命名,污染名字空间
# - 函数:map()/filter()
# - 语法:可以函数内部定义函数,闭包支持
# 详细说说tuple、list、dict的用法,它们的特点;
# - tuple 固定长度的子项不可变的顺序型容器,一般用来做常量(策划配表)或者表示少量属性的对象(比如pos)表示
# 规则配置仅供参考,适用于 Surge Mac (1.2.0) 及其后续版本;
# 包含 Proxy Group、URL Rewrite 特性;
# 包含 Reject 规则,用于拦截广告、行为分析、数据统计;
# 屏蔽 Hao123、百度搜索,放行百度地图、百度外卖、百度音乐、百度云盘、百度百科。
# Surge for Mac 简明指南 http://bit.ly/1TATRaG
[General]
# warning, notify, info, verbose
skip-proxy = 127.0.0.1, 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12, 100.64.0.0/10, localhost, *.local
bypass-tun = 192.168.0.0/16, 10.0.0.0/8, 172.16.0.0/12
dns-server = 119.29.29.29, 223.5.5.5, 114.114.114.114
@mackjoner
mackjoner / vector.py
Created June 16, 2016 06:50 — forked from mcleonard/vector.py
A vector class in pure python.
"""
The MIT License (MIT)
Copyright (c) 2015 Mat Leonard
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@mackjoner
mackjoner / update_gfwlist.sh
Created June 27, 2016 02:16 — forked from VincentSit/update_gfwlist.sh
Automatically update the PAC for ShadowsocksX. Only tested on OS X.
#!/bin/bash
# update_gfwlist.sh
# Author : VincentSit
# Copyright (c) http://xuexuefeng.com
#
# Example usage
#
# ./whatever-you-name-this.sh
#
# Task Scheduling (Optional)