Skip to content

Instantly share code, notes, and snippets.

View QGB's full-sized avatar
💭
unhappy=

Too large to fit in the margin QGB

💭
unhappy=
  • Please
  • Follow me
View GitHub Profile
@aallan
aallan / async_webserver.py
Created July 4, 2022 15:38
An asynchronous webserver written in MicroPython to turn an LED on/off on a Raspberry Pi Pico W
import network
import socket
import time
from machine import Pin
import uasyncio as asyncio
led = Pin(15, Pin.OUT)
onboard = Pin("LED", Pin.OUT, value=0)
@oofnikj
oofnikj / answerfile
Last active May 4, 2024 12:20
Install Docker on Termux
KEYMAPOPTS="us us"
HOSTNAMEOPTS="-n alpine"
INTERFACESOPTS="auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
hostname alpine
"
TIMEZONEOPTS="-z UTC"
#!/bin/bash
if [[ -z "$NGROK_TOKEN" ]]; then
echo "Please set 'NGROK_TOKEN'"
exit 2
fi
if [[ -z "$USER_PASS" ]]; then
echo "Please set 'USER_PASS' for user: $USER"
@vielhuber
vielhuber / 01.js
Last active February 15, 2024 13:21
Google Translate API Hacking #knowhow #tools
function Bp(a, b) {
var c = b.split(".");
b = Number(c[0]) || 0;
for (var d = [], e = 0, f = 0; f < a.length; f++) {
var h = a.charCodeAt(f);
128 > h ? d[e++] = h : (2048 > h ? d[e++] = h >> 6 | 192 : (55296 == (h & 64512) && f + 1 < a.length && 56320 == (a.charCodeAt(f + 1) & 64512) ? (h = 65536 + ((h & 1023) << 10) + (a.charCodeAt(++f) & 1023), d[e++] = h >> 18 | 240, d[e++] = h >> 12 & 63 | 128) : d[e++] = h >> 12 | 224, d[e++] = h >> 6 & 63 | 128), d[e++] = h & 63 | 128)
}
a = b;
for (e = 0; e < d.length; e++) a += d[e], a = Ap(a, "+-a^+6");
a = Ap(a, "+-3^+b+-f");
@pedrominicz
pedrominicz / telnet.py
Last active April 19, 2023 20:53
Extremely simple "distributed echo server" server in Python (Telnet clients should be able to connect to it).
#!/usr/bin/env python3
import socket
# Read "distributed echo server" as "(distributed echo) server". The "server"
# is not "distributed" but the echos are "distributed" to every connected
# client.
# Connect to the server with `telnet localhost 5000`.
@cyrus007
cyrus007 / BLE_UART_SERVER.ino
Created January 9, 2020 21:53
ESP32 BLE server
/*
* "ESP32 BLE Server"
*
* Control RGB LED and two servos using the Android app "Bluetooth Remote".
* 1) create a BLE Device;
* 2) create a BLE Server;
* 3) create a BLE UART Service with one characteristic for TX
* and one for RX using the following UUIDs:
* 6E400001-B5A3-F393-E0A9-E50E24DCCA9E for the Service,
* 6E400002-B5A3-F393-E0A9-E50E24DCCA9E for the TX Characteristic (Property = Notify),
@tfeldmann
tfeldmann / duplicates.py
Last active January 19, 2024 23:36
Fast duplicate file finder written in python
#!/usr/bin/env python
"""
Fast duplicate file finder.
Usage: duplicates.py <folder> [<folder>...]
Based on https://stackoverflow.com/a/36113168/300783
Modified for Python3 with some small code improvements.
"""
import os
import sys
@tvst
tvst / SessionState.py
Last active April 14, 2024 20:24
DO NOT USE!!! Try st.session_state instead.
"""Hack to add per-session state to Streamlit.
Usage
-----
>>> import SessionState
>>>
>>> session_state = SessionState.get(user_name='', favorite_color='black')
>>> session_state.user_name
''
@c2h2
c2h2 / v2ray_config.json
Created September 17, 2019 15:33
sample v2ray config.json
{
"dns" : {
"servers" : [
"1.1.1.1"
]
},
"inbounds" : [
{
"listen" : "0.0.0.0",