Skip to content

Instantly share code, notes, and snippets.

@ii0
ii0 / 01-package.py
Created April 12, 2021 14:11 — forked from WhiteRobe/01-package.py
0-1背包与完全背包
def time_test(repeat_times=5000):
"""
函数运行效率装饰器
@see https://blog.csdn.net/Shenpibaipao/article/details/88044951
:param repeat_times: 重复次数
:return: 原函数结果
"""
def func_acceptor(func):
def wrapper(*arg, **args):
import time
@ii0
ii0 / notify.py
Created July 16, 2020 06:11 — forked from lukaszb/notify.py
Simple Python script to send notification to the OSX Notifications Center (requires OS X 10.8+). Tested with pyobjc 2.5.1
#!/usr/bin/env python
from Foundation import NSUserNotification
from Foundation import NSUserNotificationCenter
from Foundation import NSUserNotificationDefaultSoundName
from optparse import OptionParser
def main():
parser = OptionParser(usage='%prog -t TITLE -m MESSAGE')
@ii0
ii0 / FileSplitter.py
Created November 23, 2019 03:01 — forked from msharp/FileSplitter.py
python script to split a (large) file into multiple (smaller) files with specified number of lines
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import os
class FileSplitter:
def __init__(self):
self.parse_args(sys.argv)
@ii0
ii0 / flask-upload
Created August 20, 2019 08:27 — forked from dAnjou/flask-upload
Flask upload example
<VirtualHost *>
ServerName example.com
WSGIDaemonProcess www user=max group=max threads=5
WSGIScriptAlias / /home/max/Projekte/flask-upload/flask-upload.wsgi
<Directory /home/max/Projekte/flask-upload>
WSGIProcessGroup www
WSGIApplicationGroup %{GLOBAL}
Order deny,allow
@ii0
ii0 / dep.md
Created July 26, 2019 02:20 — forked from subfuzion/dep.md
Concise guide to golang/dep

Overview

This gist is based on the information available at golang/dep, only slightly more terse and annotated with a few notes and links primarily for my own personal benefit. It's public in case this information is helpful to anyone else as well.

I initially advocated Glide for my team and then, more recently, vndr. I've also taken the approach of exerting direct control over what goes into vendor/ in my Dockerfiles, and also work from isolated GOPATH environments on my system per project to ensure that dependencies are explicitly found under vendor/.

At the end of the day, vendoring (and committing vendor/) is about being in control of your dependencies and being able to achieve reproducible builds. While you can achieve this manually, things that are nice to have in a vendoring tool include:

@ii0
ii0 / gist:89174b3e4b779dcb6f4963448db24bbe
Created July 3, 2019 06:59 — forked from davidnunez/gist:1404789
list all installed packages in android adb shell
pm list packages -f
@ii0
ii0 / bezdraw.py
Created June 21, 2019 01:54 — forked from Alquimista/bezdraw.py
Draw Bezier curves using Python and PyQt
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import sys
import math
from PyQt4 import QtGui, QtCore
def binomial(i, n):
@ii0
ii0 / EmacsKeyBinding.dict
Created June 19, 2019 08:39 — forked from jwreagor/EmacsKeyBinding.dict
Global Emacs Key Bindings for OS X
{
/* Keybindings for emacs emulation. Compiled by Jacob Rus.
*
* This is a pretty good set, especially considering that many emacs bindings
* such as C-o, C-a, C-e, C-k, C-y, C-v, C-f, C-b, C-p, C-n, C-t, and
* perhaps a few more, are already built into the system.
*
* BEWARE:
* This file uses the Option key as a meta key. This has the side-effect
* of overriding Mac OS keybindings for the option key, which generally
import pylab
import bs4
def get_mcd_content():
path = 'C:/Users/aneasystone/Desktop/11.mcd'
mcd = ''
with open(path, 'rb') as file:
mcd = file.read()
return str(mcd)
@ii0
ii0 / drag_and_drop_helper.js
Last active June 12, 2019 10:05 — forked from rcorreia/drag_and_drop_helper.js
drag_and_drop_helper.js
(function( $ ) {
$.fn.simulateDragDrop = function(options) {
return this.each(function() {
new $.simulateDragDrop(this, options);
});
};
$.simulateDragDrop = function(elem, options) {
this.options = options;
this.simulateEvent(elem, options);
};