Skip to content

Instantly share code, notes, and snippets.

View mackjoner's full-sized avatar

Funbeta mackjoner

View GitHub Profile
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
#author: rex
#blog: http://iregex.org
#filename tr.py
#created: 2010-08-01 20:24
#source uri: http://iregex.org/blog/trie-in-python.html
# escape bug fix by fcicq @ 2012.8.19
@mackjoner
mackjoner / gist:ab7c28a9eee029195b60
Last active September 22, 2015 10:17
crontab 設定

crontabの書き方

crontabの書き方

  • 設定書式
  • 設定項目は左から「分」「時」「日」「月」「曜日」となっている。
* * * * * [実行コマンド]

测试平台:DigitalOcean VPS ubuntu14.04 x64, strongswan5.2.2

运行以下命令请使用root权限

一:安装strongswan

由于ubuntu软件仓库中strongswan版本较低,因此从官网源码编译安装

apt-get install build-essential     #编译环境
aptitude install libgmp10 libgmp3-dev libssl-dev pkg-config libpcsclite-dev libpam0g-dev     #编译所需要的软件
@mackjoner
mackjoner / _service.md
Created November 24, 2015 02:47 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@mackjoner
mackjoner / beanstalkd.init.sh
Created November 24, 2015 03:16 — forked from jessesanford/beanstalkd.init.sh
Better beanstalkd init script for debian/ubuntu
#!/bin/sh
#
# Copyright (c) 2012 NGMOCO
# Updated by Jesse Sanford <jsanford@ngmoco.com>
#
# Portions taken from debian package by
# Javier Fernandez-Sanguino <jfs@debian.org>
#
# This is free software; you may redistribute it and/or modify
# it under the terms of the GNU General Public License as
#!/bin/sh
git filter-branch --env-filter '
OLD_EMAIL="your-old-email@example.com"
CORRECT_NAME="Your Correct Name"
CORRECT_EMAIL="your-correct-email@example.com"
if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ]
then
@mackjoner
mackjoner / Flask-Restful_S3_File_Upload.py
Created December 29, 2015 02:45 — forked from RishabhVerma/Flask-Restful_S3_File_Upload.py
Uploading a file to S3 while using Flask with Flask-Restful to create a REST API.
# -*- coding: utf-8 -*-
"""
An example flask application showing how to upload a file to S3
while creating a REST API using Flask-Restful.
Note: This method of uploading files is fine for smaller file sizes,
but uploads should be queued using something like celery for
larger ones.
"""
from cStringIO import StringIO
@mackjoner
mackjoner / install-squid.sh
Created December 31, 2015 05:36 — forked from cdodd/install-squid.sh
Install a basic squid proxy with authentication on Centos 6 x64. Just modify the variables at the top and run the script on a clean system.
#!/bin/sh
PROXY_USER=user
PROXY_PASS=password
PROXY_PORT=3128
# Clear the repository index caches
yum clean all
# Update the operating system
@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