Skip to content

Instantly share code, notes, and snippets.

(progn
;; http://d.hatena.ne.jp/kiwanami/20110224/1298526678
(defvar ac-yas-expand-autostart-backup nil "保存用")
(defun ac-yas-expand-start ()
"yasnippet展開開始時にはACを止める"
(setq ac-yas-expand-autostart-backup ac-auto-start)
(setq ac-auto-start nil))
(defun ac-yas-expand-end ()
@qiao
qiao / stackoverflow_monitor.py
Created January 5, 2012 10:21
Monitor for new questions on StackOverflow
#!/usr/bin/env python
# Monitor for new questions on StackOverflow
# Author: Xueqiao Xu <xueqiaoxu@gmail.com>
import time
import json
import gzip
import pprint
import urllib
import urllib2
@erikh
erikh / hack.sh
Created March 31, 2012 07:02 — forked from DAddYE/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@jexchan
jexchan / multiple_ssh_setting.md
Created April 10, 2012 15:00
Multiple SSH keys for different github accounts

Multiple SSH Keys settings for different github account

create different public key

create different ssh key according the article Mac Set-Up Git

$ ssh-keygen -t rsa -C "your_email@youremail.com"
@danielepolencic
danielepolencic / dSlideshare
Created April 23, 2012 16:02
Workaround for disabled download button on SlideShare [www.coconutmonarchy.com]
#!/bin/bash
if [ -z "$1" ]; then
echo "";echo "[i] Usage: `basename $0` http://www.slideshare.net/link_with_presentation";echo "";exit
fi
presentation=`curl -s --user-agent 'Mozilla/5.0' "$1" | tr '"' "\n" | egrep -m 1 -e "static\.slidesharecdn\.com\/swf\/ssplayer2\.swf\?doc=(.*?)\{rel}{startSlide}" | cut -d '{' -f 1 | cut -d '=' -f 2`
pages=`curl -s --user-agent 'Mozilla/5.0' "$1" | grep -m 1 "slideshare_object" | sed 's/.*total_slides":\([^,]*\).*/\1/'`
version=`curl -s --user-agent 'Mozilla/5.0' "$1" | grep -m 1 "slideshare_object" | sed 's/.*version_no":"\([^""]*\).*/\1/'`
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active July 23, 2024 05:34
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@mfenniak
mfenniak / gist:2978805
Created June 23, 2012 16:01
An extension of Flask that adds file hashes to static file URLs built by url_for("static"...)
import os.path
import contextlib
import hashlib
from flask import Flask
from flask.helpers import safe_join
# Injects an "h" parameter on the URLs of static files that contains a hash of
# the file. This allows the use of aggressive cache settings on static files,
# while ensuring that content changes are reflected immediately due to the
# changed URLs. Hashes are cached in-memory and only checked for updates when
@lecram
lecram / escher.py
Last active August 27, 2021 07:05
This is a toy one-file application to manage persistent key-value string data. The file is *both* the application and its data. When you run any of the commands described in `escher.py --help`, the file will be executed and, after data change, it will rewrite itself with updated data. You can copy the file with whatever name to create multiple d…
#! /usr/bin/env python
"""{escher} -- one-file key-value storage.
What?
This is a toy application to manage persistent key-value string data.
The file {escher} is *both* the application and its data.
When you run any of the commands below, the file will be executed and,
after data change, it will rewrite itself with updated data.
You can copy the file with whatever name to create multiple datasets.
@insin
insin / gulpfile.js
Last active September 15, 2016 08:35
gulpfile for use with React, with flat imports from uniquely-named modules under /src
/*
gulpfile from one of my React applications which has a gulp --production build
set up.
Assumptions:
1. All your own .js/.jsx modules are somewhere under ./src, have unique
filenames and use Node.js-style requires WITHOUT any path information, just
the name of another module somewhere under ./src
@hustlzp
hustlzp / examples.py
Last active September 7, 2017 09:03
Flask permission control
# 用于view的装饰器
from ..utils.permissions import VisitorPermission
@bp.route('/signin', methods=['GET', 'POST'])
@VisitorPermission()
def signin():
"""登陆"""
form = SigninForm()
if form.validate_on_submit():
signin_user(form.user)