This file contains 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
#!/bin/sh | |
. /etc/init.d/tc-functions | |
# Use this script to extract and re-package core.gz, core64.gz or corepure64.gz | |
# | |
# Note | |
# When repackaging a x86_64 core, use this script on same type system (core64 or corepure64) | |
# | |
# How to.. |
This file contains 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
#lifted from http://stackoverflow.com/questions/17248383/pretty-print-by-default-in-python-repl | |
import pprint | |
import sys | |
orig_displayhook = sys.displayhook | |
def myhook(value): | |
if value != None: | |
__builtins__._ = value |
This file contains 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
# add hg info to the prompt if it exists... | |
in_hg() { | |
# returns 0 if in a hg repo, 1 if not | |
d=$PWD | |
# Check up the path (using bash string operators) looking for .hg | |
while [ "${d}" != "" ]; do | |
if [ -d "${d}/.hg" ]; then | |
HG_DIR=$d/.hg | |
return 0 | |
fi |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 | |
import Queue | |
import time | |
QUEUE_TIMEOUT_s = 0.1 | |
WORKER_COUNT = 200 # play with this! If switching to multiprocessing, use ncores+1 (or 2) | |
NUM_TASKS = 1000 | |
SLOW_ADD_TIME_s = 0.1 | |
done_event = threading.Event() |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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 sys | |
from PyQt5 import QtCore, QtQml, QtWidgets | |
QML = b''' | |
import QtQuick 2.7 | |
import QtQuick.Window 2.2 | |
import QtQuick.Controls 1.4 | |
import ObjectNameTester 1.0 | |
Window { |
This file contains 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 time | |
import sys | |
DELAY = 0.2 | |
for i in range(10): | |
sys.stdout.write("1") | |
time.sleep(DELAY) | |
sys.stdout.write("\r\n") |
This file contains 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
get_ssh_client_ip() { | |
# Returns (via stdout) the IP address for the currently connected SSH session | |
# - this relies on the ssh server setting the SSH_CLIENT env var (done by openssh, dropbear, etc) | |
pid=$$ # current pid will be checked | |
while [ "$pid" -ne 1 ]; do | |
cip=$(cat /proc/$pid/environ | tr '\0' '\n' | grep 'SSH_CLIENT=' | awk -F'[= ]' '{ print $2 }') | |
[ -n "$cip" ] && break # got it! | |
pid=$(awk '{ print $4 }' /proc/$pid/stat) # the parent pid for the next try | |
done |
This file contains 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 struct | |
try: | |
from time import perf_counter as clock | |
except ImportError: | |
from time import time as clock | |
import asyncio | |
import uvloop | |
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy()) |
OlderNewer