This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo apt-get install build-essential libreadline-dev zlib1g-dev python3-dev | |
$ wget http://ftp.postgresql.org/pub/source/v9.3.4/postgresql-9.3.4.tar.bz2 -O - | tar xj | |
$ pushd postgresql-9.3.4 | |
$ PYTHON=`which python3` ./configure --with-python && make | |
$ sudo make install | |
$ popd | |
$ sudo tee /etc/ld.so.conf.d/pgsql.conf | |
/usr/local/pgsql/lib | |
$ sudo ldconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo apt-get install -y build-essential zlib1g libbz2-dev liblzma-dev libsqlite3-dev libexpat1-dev libffi-dev libmpdec-dev libncursesw5-dev libreadline-dev libtinfo-dev libssl-dev | |
$ wget https://www.python.org/ftp/python/3.4.1/Python-3.4.1.tar.xz -O -| tar xJ | |
$ pushd Python-3.4.1/ | |
$ ./configure && make | |
$ ./python -c "import bz2, ctypes, decimal, hashlib, lzma, sqlite3, ssl, xml.etree.ElementTree" | |
$ sudo make install | |
$ popd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo apt-get install build-essential libncurses-dev libevent-dev -y | |
$ wget http://downloads.sourceforge.net/tmux/tmux-1.9a.tar.gz -O - | tar xz | |
$ pushd tmux-1.9a/ && ./configure && make && sudo make install && popd | |
PuTTY 0.63 (win32, Ctrl+Tab enabled version) | |
https://docs.google.com/uc?export=download&id=0B7fc_tGKucbqdlV0NHZWejhNUlU |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ wget http://download.redis.io/releases/redis-2.8.8.tar.gz -O - | tar xz | |
$ pushd redis-2.8.8 && make && sudo make install && popd | |
$ sudo adduser --system --no-create-home --disabled-password --disabled-login redis | |
$ sudo tee /etc/init/redis-server.conf | |
description "redis server" | |
start on runlevel [23] | |
stop on shutdown | |
exec sudo -u redis redis-server /etc/redis.conf |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import argparse | |
import logging; logger = logging.getLogger('__main__') | |
def parse_args(args=None): | |
parser = argparse.ArgumentParser() | |
parser.add_argument('--verbose', '-v', default=0, action='count') | |
return parser.parse_args(args) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!python3 | |
import struct | |
from win32security import SID, ConvertStringSidToSid, ConvertSidToStringSid | |
from pywintypes import SIDType | |
def CopySID(sid: SIDType) -> SIDType: | |
"""Alternative way: ConvertStringSidToSid(ConvertSidToStringSid(sid)) | |
""" | |
result = SID() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!python3 | |
"""tkinter and ExplorerBrowser | |
""" | |
# Original codes are from pywin32/com/win32comext/shell/demos explorer_browser.py | |
import sys | |
from tkinter import * | |
from tkinter.ttk import * | |
import pythoncom | |
import pywintypes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
import os | |
if sys.platform == 'win32' and sys.version[:3] >= '3.1' and os.path.splitext(os.path.basename(sys.executable))[0].lower() == 'python': | |
import io | |
def reset_stdout(stream): | |
result = io.TextIOWrapper( | |
stream.detach(), | |
encoding=stream.encoding, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!python3 | |
"""`wmi.py`'s querying is very slow when fetching many items (ex. Win32_NTLogEvent). There are 2 solutions: | |
1. Use 'wmi._wmi_namespace._raw_query'. | |
2. Hack 'wmi._wmi_namespace.query'. | |
""" | |
import wmi | |
# Use 'wmi._wmi_namespace._raw_query'. | |
c = wmi.WMI(privileges=['Security']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
% wget https://www.python.org/ftp/python/3.5.2/Python-3.5.2.tar.xz | |
% tar xJf Python-3.5.2.tar.xz | |
% cd Python-3.5.2 | |
% ./configure --prefix=$HOME/python-3.5/ | |
% make | |
% make install | |
% ~/python-3.5/bin/python3 -c "import bz2, ctypes, decimal, hashlib, lzma, sqlite3, ssl, xml.etree.ElementTree" | |
% mkdir ~/bin | |
% ln -s ~/python-3.5/bin/python3.5 ~/bin/python3 | |
% ln -s ~/python-3.5/bin/idle3.5 ~/bin/idle3 |
OlderNewer