Skip to content

Instantly share code, notes, and snippets.

View cwen0's full-sized avatar
🎯
Focusing

Cwen Yin cwen0

🎯
Focusing
View GitHub Profile
import os, time
def is_locked(filepath):
"""Checks if a file is locked by opening it in append mode.
If no exception thrown, then the file is not locked.
"""
locked = None
file_object = None
if os.path.exists(filepath):
try:

Keybase proof

I hereby claim:

  • I am cwen0 on github.
  • I am cwen (https://keybase.io/cwen) on keybase.
  • I have a public key ASCRa-qUJDsaAWoXRaC0YDYzMxS3VnSjZVeQBbxXSzeD9Qo

To claim this, I am signing this object:

@cwen0
cwen0 / tmux-cheatsheet.markdown
Created April 26, 2017 05:55 — forked from ryerh/tmux-cheatsheet.markdown
Tmux 快捷键 & 速查表

Tmux 快捷键 & 速查表

启动新会话:

tmux [new -s 会话名 -n 窗口名]

恢复会话:

tmux at [-t 会话名]
@cwen0
cwen0 / tmux-cheatsheet.markdown
Created April 26, 2017 05:54 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@cwen0
cwen0 / tpcc_load_parallel.sh
Created April 17, 2017 06:49 — forked from sh2/tpcc_load_parallel.sh
Parallel load script for tpcc-mysql
#!/bin/bash
# Configration
MYSQL=/usr/bin/mysql
TPCCLOAD=./tpcc_load
TABLESQL=./create_table.sql
CONSTRAINTSQL=./add_fkey_idx.sql
DEGREE=`getconf _NPROCESSORS_ONLN`