Skip to content

Instantly share code, notes, and snippets.

# pip install retryz backoff
from __future__ import print_function
import random
import retryz
import backoff
def naughty_func():
picky = random.randint(1, 3)
@joepie91
joepie91 / .md
Last active April 26, 2025 07:10
Running a Node.js application using nvm as a systemd service

Read this first!

Hi there! Since this post was originally written, nvm has gained some new tools, and some people have suggested alternative (and potentially better) approaches for modern systems. Make sure to have a look at the comments to this article, before following this guide!


The original article

Trickier than it seems.

@abrasumente233
abrasumente233 / nesign.py
Last active June 26, 2022 01:46
网易云音乐签到(pc android)
# -*- coding: utf-8 -*-
"""网易云自动签到"""
import requests
__author__ = 'abrasumente'
@dongyuwei
dongyuwei / MagickWand-sucks.md
Last active July 25, 2024 19:44
ImportError: MagickWand shared library not found. You probably had not installed ImageMagick library.

Wand==0.3.7, Python 3.4.3, OSX EI Capitan 10.11

when run from wand.image import Image it throw errors:

ImportError: MagickWand shared library not found. You probably had not installed ImageMagick library. Try to install: brew install freetype imagemagick

ok, first I try this:

@jk2K
jk2K / appcrush.py
Created May 26, 2015 07:03
appcrush.rb的python版本
# coding=utf-8
import os
import sys
import glob
pngcrush = "/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/pngcrush"
destination = os.path.join(os.environ['HOME'], 'Desktop')
for ipa in sys.argv:
@gumblex
gumblex / num2chinese.py
Created February 8, 2015 02:46
Numbers to Chinese representations converter in Python. 中文数字转换
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Licensed under WTFPL or the Unlicense or CC0.
# This uses Python 3, but it's easy to port to Python 2 by changing
# strings to u'xx'.
import itertools
def num2chinese(num, big=False, simp=True, o=False, twoalt=False):
@mitio
mitio / README.md
Last active August 9, 2018 14:01
A simple init.d script for the psdash tool

Installation (on a Debian machine):

  1. Install psdash
  2. Save the contents of the init.d script in /etc/init.d/psdash and edit it to fit your OS and paths
  3. Make it exectutable: chmod a+rx /etc/init.d/psdash
  4. Run update-rc.d psdash defaults
  5. Start the daemon with /etc/init.d/psdash start

Optionally, setup a proxy pass to psdash's port (TCP 5000) and add some form of authentication there.

@gruber
gruber / Liberal Regex Pattern for Web URLs
Last active April 22, 2025 16:56
Liberal, Accurate Regex Pattern for Matching Web URLs
The regex patterns in this gist are intended only to match web URLs -- http,
https, and naked domains like "example.com". For a pattern that attempts to
match all URLs, regardless of protocol, see: https://gist.github.com/gruber/249502
# Single-line version:
(?i)\b((?:https?:(?:/{1,3}|[a-z0-9%])|[a-z0-9.\-]+[.](?:com|net|org|edu|gov|mil|aero|asia|biz|cat|coop|info|int|jobs|mobi|museum|name|post|pro|tel|travel|xxx|ac|ad|ae|af|ag|ai|al|am|an|ao|aq|ar|as|at|au|aw|ax|az|ba|bb|bd|be|bf|bg|bh|bi|bj|bm|bn|bo|br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|cr|cs|cu|cv|cx|cy|cz|dd|de|dj|dk|dm|do|dz|ec|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gg|gh|gi|gl|gm|gn|gp|gq|gr|gs|gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|im|in|io|iq|ir|is|it|je|jm|jo|jp|ke|kg|kh|ki|km|kn|kp|kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|me|mg|mh|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu|mv|mw|mx|my|mz|na|nc|ne|nf|ng|ni|nl|no|np|nr|nu|nz|om|pa|pe|pf|pg|ph|pk|pl|pm|pn|pr|ps|pt|pw|py|qa|re|ro|rs|ru|rw|sa|sb|sc|sd|se|sg|sh|si|s
@dschien
dschien / plot_radar_results.py
Created February 4, 2014 15:04
From matplotlib radar example
__author__ = 'schien'
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.projections.polar import PolarAxes
from matplotlib.projections import register_projection
def radar_factory(num_vars, frame='circle'):
"""Create a radar chart with `num_vars` axes."""