This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import redis | |
| import time | |
| import json | |
| r = redis.Redis(host='localhost', port=6379, db=0) | |
| for i in range(100): | |
| print(i) | |
| r.rpush('tasks', json.dumps({'task': i})) | |
| time.sleep(0.5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import redis | |
| import time | |
| import json | |
| r = redis.Redis(host='localhost', port=6379, db=0) | |
| for i in range(100): | |
| print(i) | |
| r.rpush('tasks', json.dumps({'task': i})) | |
| time.sleep(0.5) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import threading | |
| from ctypes import cdll | |
| lib = cdll.LoadLibrary('./liblib.so') | |
| class Foo(object): | |
| def __init__(self): | |
| self.obj = lib.Foo_new() | |
| def bar(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| load: 0.369427308000013 | |
| find: 0.03731154500019329 | |
| sample 1: ['6.19889798576753', '306.03317783754981', 'NCV'] | |
| sample 2: ['6.19889798576753', '306.03317783754981', 'NCV'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # client.py | |
| import requests | |
| print(requests.post('http://127.0.0.1:8001/test/command', json={'id': 1, 'params': 'Hello'}).json()) | |
| # worker.py | |
| import requests | |
| while True: | |
| req = requests.post('http://127.0.0.1:8001/test/command', headers={'Type': 'get'}).json() | |
| response = { | |
| 'id': req['id'], |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import com.rabbitmq.client.AMQP; | |
| import com.rabbitmq.client.Channel; | |
| import com.rabbitmq.client.Connection; | |
| import com.rabbitmq.client.ConnectionFactory; | |
| import java.io.IOException; | |
| import java.util.UUID; | |
| import java.util.concurrent.ArrayBlockingQueue; | |
| import java.util.concurrent.BlockingQueue; | |
| import java.util.concurrent.TimeoutException; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // file /usr/share/X11/xkb/symbols/se | |
| partial alphanumeric_keys | |
| xkb_symbols "se" { | |
| name[Group1]="Swedish"; | |
| // tool: xev | |
| // mapping key file: /usr/share/X11/xkb/keycodes/evdev | |
| // reload conf: setxkbmap -layout se | |
| // key <code> {[ default, +shift, +altGr, +shit +altgr ]}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| words = ['abc', 'ubuntu', 'linux', 'ubuntu 16 LTS', 'redhat', 'unix', 'windows', 'macos X'] | |
| def tre(w): | |
| w = w.lower() | |
| r = {'__' + w[0], '_' + w[:2]} | |
| for i in range(len(w)): | |
| k = w[i:i+3] | |
| while len(k) < 3: | |
| k += '_' | |
| r.add(k) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # xkbcomp 2.xkb $DISPLAY | |
| # xkbcomp $DISPLAY - > init.2 | |
| # xmodmap | |
| xkb_keymap { | |
| xkb_keycodes { | |
| include "evdev+aliases(qwerty)" | |
| <LALT> = 108; | |
| <RALT> = 64; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <script> | |
| let todos = []; | |
| let duration = ''; | |
| function timeit(fn) { | |
| let start = Date.now(); | |
| fn(); | |
| setTimeout(() => { | |
| duration += ' + ' + (Date.now() - start); | |
| }, 10); |