Skip to content

Instantly share code, notes, and snippets.

View JokerQyou's full-sized avatar

Joker_ JokerQyou

View GitHub Profile
@JamieMason
JamieMason / is_installed.sh
Last active February 17, 2024 10:12
Check if a program exists from a bash script.Thanks to twitter.com/joshnesbitt and twitter.com/mheap for the help with detecting npm packages.
#!/bin/bash
# Functions ==============================================
# return 1 if global command line program installed, else 0
# example
# echo "node: $(program_is_installed node)"
function program_is_installed {
# set to 1 initially
local return_=1
@dbridges
dbridges / CustomSortFilterProxyModel.py
Last active December 1, 2022 22:11
A subclass of QSortFilterProxyModel that implements custom filtering, especially useful for multicolumn filtering.
from PySide import QtGui
class CustomSortFilterProxyModel(QtGui.QSortFilterProxyModel):
"""
Implements a QSortFilterProxyModel that allows for custom
filtering. Add new filter functions using addFilterFunction().
New functions should accept two arguments, the column to be
filtered and the currently set filter string, and should
return True to accept the row, False otherwise.
@jakeonrails
jakeonrails / Ruby Notepad Bookmarklet
Created January 29, 2013 18:08
This bookmarklet gives you a code editor in your browser with a single click.
data:text/html, <style type="text/css">#e{position:absolute;top:0;right:0;bottom:0;left:0;}</style><div id="e"></div><script src="http://d1n0x3qji82z53.cloudfront.net/src-min-noconflict/ace.js" type="text/javascript" charset="utf-8"></script><script>var e=ace.edit("e");e.setTheme("ace/theme/monokai");e.getSession().setMode("ace/mode/ruby");</script>
@yefuchs
yefuchs / gfw_contributors.md
Last active March 4, 2024 05:24
GFW Contributers

#The Great Firewall (GFW) Contributors List

注:数据来源为 dblp 和 cndblp, 下面括号中的数字表示 dblp 中显示的跟方滨兴合作论文的数量

###Binxing Fang (方滨兴)

中国工程院院士,北京邮电大学教授,中国科学院计算技术研究所网络方向首席科学家
http://en.wikipedia.org/wiki/Fang_Binxing

@tpulmano
tpulmano / gist:4349575
Created December 20, 2012 23:36
PyQt4 Drag And Drop Example
import sys
from PyQt4 import QtGui
from PyQt4 import QtCore
from PyQt4.QtCore import Qt
class DragFromWidget(QtGui.QDockWidget):
def __init__(self, parent=None):
super(DragFromWidget, self).__init__(parent=parent)
@abeluck
abeluck / gpg-offline-master.md
Last active October 22, 2023 02:59 — forked from KenMacD/cmd.md
GPG Offline Master Key w/ smartcard
@efeminella
efeminella / enhance.helper.js
Created March 14, 2012 04:57
Plain text URL to anchor tags Handlebars Helper
// Plain text URL to anchor tags Handlebars Helper
(function(){
// defines markup enhancement regex
var protocol = /(\b(https?|ftp):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/gim
, scheme = /(^|[^\/])(www\.[\S]+(\b|$))/gim;
/*
* Registers a Helper method with handlebars which, given a string of
* plain text or existing markup, provides enhancements of plain text
@oodavid
oodavid / README.md
Last active April 6, 2024 18:45 — forked from aronwoost/README.md
Deploy your site with git

Deploy your site with git

This gist assumes:

  • you have a local git repo
  • with an online remote repository (github / bitbucket etc)
  • and a cloud server (Rackspace cloud / Amazon EC2 etc)
    • your (PHP) scripts are served from /var/www/html/
    • your webpages are executed by apache
  • apache's home directory is /var/www/
@zhangchunlin
zhangchunlin / setiptables.py
Created December 23, 2011 09:46
a little python script using to set iptables
#! /usr/bin/env python
#coding=utf-8
#----config part----
INIT_CMDS = ["iptables -F",#clean all
"iptables -X",
"iptables -t nat -F",
"iptables -t nat -X",
"iptables -P INPUT DROP",#forbid all
"iptables -A INPUT -i lo -j ACCEPT"#accept all localhost
@turicas
turicas / attrdict.py
Created December 22, 2011 16:21
Python class with dict-like get/set item
#!/usr/bin/env python
# coding: utf-8
class AttrDict(object):
def __init__(self, init=None):
if init is not None:
self.__dict__.update(init)
def __getitem__(self, key):
return self.__dict__[key]