Skip to content

Instantly share code, notes, and snippets.

View Saliva520319's full-sized avatar

ChuFengze Saliva520319

View GitHub Profile
@Saliva520319
Saliva520319 / daemon.py
Created September 28, 2022 14:55 — forked from josephernest/daemon.py
Daemon for Python
# From "A simple unix/linux daemon in Python" by Sander Marechal
# See http://stackoverflow.com/a/473702/1422096 and http://web.archive.org/web/20131017130434/http://www.jejik.com/articles/2007/02/a_simple_unix_linux_daemon_in_python/
#
# Modified to add quit() that allows to run some code before closing the daemon
# See http://stackoverflow.com/a/40423758/1422096
#
# Modified for Python 3 (see also: http://web.archive.org/web/20131017130434/http://www.jejik.com/files/examples/daemon3x.py)
#
# Joseph Ernest, 20200507_1220
@Saliva520319
Saliva520319 / Python URL Validation.py
Created August 7, 2019 04:14 — forked from Integralist/Python URL Validation.py
[Python URL Validation] #python #urls #validation
import re
ip_middle_octet = u"(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5]))"
ip_last_octet = u"(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))"
regex = re.compile(
u"^"
# protocol identifier
u"(?:(?:https?|ftp)://)"
# user:pass authentication
@Saliva520319
Saliva520319 / lisp.rb
Created April 9, 2019 07:03 — forked from dahlia/lisp.rb
30 minutes Lisp in Ruby
# 30 minutes Lisp in Ruby
# Hong Minhee <http://dahlia.kr/>
#
# This Lisp implementation does not provide a s-expression reader.
# Instead, it uses Ruby syntax like following code:
#
# [:def, :factorial,
# [:lambda, [:n],
# [:if, [:"=", :n, 1],
# 1,
@Saliva520319
Saliva520319 / tree.md
Created March 13, 2019 10:39 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!

@Saliva520319
Saliva520319 / readme.adoc
Created February 19, 2019 03:02 — forked from arun-gupta/readme.adoc
Service Mesh and Open Tracing
@Saliva520319
Saliva520319 / 0_reuse_code.js
Created September 16, 2016 07:07
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
sync-settings