Skip to content

Instantly share code, notes, and snippets.

Joker_ JokerQyou

Block or report user

Report or block JokerQyou

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@JokerQyou
JokerQyou / cloud-init-docker.yaml&env=plain
Last active Jul 23, 2019
Cloud-init user data to install some fundamental components
View cloud-init-docker.yaml&env=plain
#cloud-config
runcmd:
- curl -fsSL https://get.docker.com | sh
- curl -L "https://github.com/docker/compose/releases/download/1.24.0/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
- chmod +x /usr/local/bin/docker-compose
- ln -s /usr/local/bin/docker-compose /usr/local/bin/dc
- apt-get install -y zsh git
groups:
@JokerQyou
JokerQyou / win_subprocess.py
Last active Apr 19, 2018 — forked from vaab/win_subprocess.py
Fixing python 2.7 windows unicode issue with ``subprocess.Popen``.
View win_subprocess.py
# coding: utf-8
# This patched `Popen` class
# adds support for Unicode commandline on Windows platform.
# issue: https://bugs.python.org/issue19264
import os
import ctypes
import subprocess
import _subprocess
from ctypes import (
@JokerQyou
JokerQyou / README.md
Last active Sep 29, 2017
Wtf is with these docker registry clients, I just want to delete an image.
View README.md

Usage:

python delete_docker_image.py 192.168.2.1:5000/hello-world:latest --delete-layers
@JokerQyou
JokerQyou / watchdog_persistent_observer.py
Created Jun 14, 2017 — forked from serge-kilimoff/watchdog_persistent_observer.py
Persistent watchdog observer. When watchdog re-start, check if new/modify/delete/etc.. files or directories since the last launch, and send events for suscribers handlers.
View watchdog_persistent_observer.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Subclassing Observer for saving states of folders, and load this states at the next observation.
TODO : mapping events and handlers dispatching, for a shorter code.
"""
from __future__ import unicode_literals, print_function, division
import cPickle as pickle
import os
@JokerQyou
JokerQyou / pattern_split.py
Created May 23, 2016
Regular expression to split by punctuation
View pattern_split.py
# coding: utf-8
from __future__ import print_function
import re
pattern = u''.join([
u'[',
u'\u0020-\u002f', # < General Latin characters, exclude @, letters and numbers
u'\u003A-\u003f',
u'\u005b-\u0060',
@JokerQyou
JokerQyou / example.py
Created May 11, 2016 — forked from schlamar/example.py
mplog: Python advanced multiprocessing logging.
View example.py
import logging
import multiprocessing
import time
import mplog
FORMAT = '%(asctime)s - %(processName)s - %(levelname)s - %(message)s'
logging.basicConfig(level=logging.DEBUG, format=FORMAT)
existing_logger = logging.getLogger('x')
@JokerQyou
JokerQyou / agtrunc
Last active Apr 19, 2016 — forked from tweekmonster/agtrunc
A script to truncate the_silver_searcher's output in Vim
View agtrunc
#!/usr/bin/env python
'''Truncates matches from ag
Place this script somewhere in your $PATH, like ~/bin and pipe ag into it.
Vim could be setup like this:
if executable('ag')
set grepprg=ag\ --vimgrep\ -w\ $*
if executable('agtrunc')
@JokerQyou
JokerQyou / osx_notify.py
Last active Jan 2, 2018 — forked from wheelpharaoh/notify.py
A python lib for sending notification on OS X
View osx_notify.py
# coding: utf-8
from Foundation import NSUserNotification
from Foundation import NSUserNotificationCenter
from Foundation import NSUserNotificationDefaultSoundName
def notify(message, title='Notification', sound=False):
notification = NSUserNotification.alloc().init()
notification.setTitle_(title)
notification.setInformativeText_(message)
if sound:
View decorator.py
import functools, inspect
def _strict_type(type_map):
'''
Check func parameter type
:param f: func
:param type_map: mapping of parameter types
:return:
'''
def _wrapped(f):
View 1) Install
// --- Compiling ---
$ wget http://download.redis.io/releases/redis-2.8.3.tar.gz
$ tar xzvf redis-2.8.3.tar.gz
$ cd redis-2.8.3
$ make
$ make install
// --- or using yum ---
$ rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
$ rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
You can’t perform that action at this time.