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
pkg upgrade | |
# Install runtime deps | |
pkg install python libzmq libcrypt | |
# Add build deps | |
pkg install python-dev libzmq-dev libcrypt-dev clang | |
pip3 install -U pip | |
pip3 install pyzmq --install-option="--zmq=/usr/lib" | |
pip3 install jupyter |
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
# gatopeich's minimal Javascript interpreter prototype | |
# Coding this as a prototype for a specific-purpose lightweight Javascript | |
# engine in C/C++. | |
# DONE: Tokenizer (except quote parsing) | |
# DONE: Expression extraction | |
# DONE: Pretty printer | |
# next: Interpreter... |
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
#!/usr/bin/env python | |
# Display status of several Jenkins jobs in system tray | |
# Tooltip shows the list of builds and status | |
# SVG-based art represents the jobs status (random circles whose color reflects build status, green for OK etc.) | |
# On click, point default browser to ON_CLICK_URL | |
JOBS_URL = 'http://jenkins/job/' | |
ON_CLICK_URL = 'http://jenkins/user/myself/my-views/view/My%20Dashboard/' | |
WGET_AUTH = '--auth-no-challenge --user=XXX --password=YYY' |
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
$ ps -eo pid,policy,rtprio,pri,nice,cmd | |
PID POL RTPRIO PRI NI CMD | |
1 TS - 19 0 /usr/lib/systemd/systemd --switched-root --system --deserialize 23 | |
2 TS - 19 0 [kthreadd] | |
3 TS - 19 0 [ksoftirqd/0] | |
5 TS - 39 -20 [kworker/0:0H] | |
6 TS - 19 0 [kworker/u16:0] | |
7 FF 99 139 - [migration/0] | |
8 TS - 19 0 [rcu_bh] | |
9 TS - 19 0 [rcu_sched] |
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
$ ~/genymotion/tools/adb devices -l | |
List of devices attached | |
192.168.57.101:5555 device product:vbox86p model:Google_Nexus_7___4_4_4___API_19___800x1280 device:vbox86p | |
$ ~/genymotion/tools/adb shell ls /data/app/com.mojang.minecraft* | |
/data/app/com.mojang.minecraftpe-1.apk | |
$ ~/genymotion/tools/adb pull /data/app/com.mojang.minecraftpe-1.apk | |
/data/app/com.mojang.minecraftpe-1.apk: 1 file pulled. 50.6 MB/s (79278178 bytes in 1.494s) |
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
from dataclasses import dataclass, fields as datafields | |
from ujson import dumps, loads | |
# Note: ujson seamlessly serializes dataclasses, unlike stdlib's json | |
@dataclass | |
class Point: | |
x: float | |
y: float | |
# Shallow dataclass can be rebuilt from dict/json: |
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/bash | |
# Generic Linux service script, systemd and LSB compatible but also working on older systems | |
# To install: | |
# 1. Place under /etc/init.d/ with the name of the service | |
# 2. sudo chmod +x /etc/init.d/my_service | |
# 3. sudo systemctl enable my_service || sudo chkconfig --add my_service | |
# 4. sudo service my_service start |
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
# /etc/systemd/system/[email protected] by gatopeich | |
######### | |
# HowTo # | |
######### | |
# | |
# - Copy this file to /etc/systemd/system/[email protected] | |
# | |
# - adduser --system --shell /bin/bash --home /opt/mcpe --group minecraft | |
# |
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
// Using TPACKET_V3 to measure interface capacity. Proof of concept by gatopeich | |
// Based on the folloging information sources: | |
// [1] Kernel documentation: https://www.kernel.org/doc/Documentation/networking/packet_mmap.txt | |
// [2] Kernel "selftest" tools: https://github.com/torvalds/linux/blob/master/tools/testing/selftests/net/psock_tpacket.c | |
// [3] Answer to "Sending data with PACKET_MMAP..." in https://stackoverflow.com/a/43427533/501336 | |
// [4] packet.7 man page http://man7.org/linux/man-pages/man7/packet.7.html | |
// [5] Kernel sources https://github.com/torvalds/linux/blob/master/net/packet/af_packet.c | |
#include <linux/if_packet.h> | |
#include <linux/if_ether.h> |
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
// In-place JSON parsing concept by gatopeich 2020 | |
// Taking advantage of C++17 features like std::string_view | |
// No rights reserved, use at your own risk! | |
#include <cstdlib> | |
#include <iostream> | |
#include <stdexcept> | |
#include <string_view> | |
namespace inplacejson |
OlderNewer