Skip to content

Instantly share code, notes, and snippets.

View 44670's full-sized avatar
🐢
I may be slow to respond.

44670

🐢
I may be slow to respond.
View GitHub Profile
@44670
44670 / netcat_udp.py
Created April 15, 2023 11:33
Netcat-like UDP Tool in Python
#!/usr/bin/env python3
"""
Netcat-like UDP Tool in Python
This Python script provides a simple and lightweight netcat-like UDP tool that allows users to
send and receive data over UDP using IPv4 and IPv6 addresses. It is designed to be easy to use
and versatile, making it suitable for various networking tasks, including testing, debugging,
and learning purposes.
By following the netcat command-line style, this script offers users a familiar interface for
@44670
44670 / gist:d8a6ef19e0aa6ab39bdba61156937d88
Created April 5, 2022 04:34
How to setup postgresql in debian 11
How to setup postgresql in debian 11:
1. Install postgresql:
apt install postgresql postgresql-contrib
2. su to postgres account, in order to manipulate the database:
su - postgres
3. Create a user and database named with mydb, set password:
createuser -P mydb
@44670
44670 / gist:42a1baa1fe770c2a37170ca0ad6f7737
Last active February 4, 2024 06:23
Allwinner D1 Set HDMI Resolution
HDMI_RESOLUTION=5 #720p
cd /sys/kernel/debug/dispdbg
echo disp0 > name; echo switch1 > command; echo 4 $HDMI_RESOLUTION 0 0 0x4 0x101 0 0 0 8 > param; echo 1 > start;
@44670
44670 / genpass.py
Created February 18, 2021 02:14
genpass.py
import getpass
import base64
from hashlib import pbkdf2_hmac
pwd = getpass.getpass()
salt = input('Website Name:')
iters = 10000
hmac = pbkdf2_hmac(hash_name='sha256',password=pwd.encode('utf8'),salt=salt.encode('utf8'),iterations=iters)
pwd = base64.b64encode(hmac).decode('utf8')
@44670
44670 / election-rebuild behind a proxy.md
Created September 20, 2020 14:10
election-rebuild behind a proxy

edit node_modules\electron-rebuild\src\rebuild.ts:

add following code when initializing rebuildArgs:

rebuildArgs.push('--proxy=http://YOUR_PROXY_SERVER')
@44670
44670 / index.html
Created August 13, 2020 08:17 — forked from corburn/index.html
Minimal HTML5
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>title</title>
<link rel="stylesheet" href="style.css">
<script src="script.js"></script>
</head>
<body>
@44670
44670 / gist:30a742f317b52780c41f3d6e256f218c
Last active August 30, 2023 11:41
Building upstream RISC-V GCC+binutils+newlib: the quick and dirty way
Building upstream RISC-V GCC+binutils+newlib: the quick and dirty way
September 5, 2017
There are a number of available options for building a RISC-V GCC toolchain. You might use the build system from the riscv/riscv-tools repository, or investigate toolchain generators such as crosstool-ng. However in the case of riscv-tools, it’s not always clear how this corresponds to the code in the relevant upstream projects. When investigating a potential bug, you often just want to build the latest upstream code with as little fuss as possible. For distribution purposes you’d probably want to perform a proper multi-stage build, but for a quick test you might find the following recipe useful:
git clone --depth=1 git://gcc.gnu.org/git/gcc.git gcc
git clone --depth=1 git://sourceware.org/git/binutils-gdb.git
git clone --depth=1 git://sourceware.org/git/newlib-cygwin.git
mkdir combined
cd combined
@44670
44670 / debian-buster-arm64-rpi4
Last active May 22, 2021 10:42
debian buster arm64 on raspberry pi 4
# build rootfs on host
debootstrap --arch=arm64 buster rootfs https://mirrors.163.com/debian/
chroot rootfs
apt install apt-transport-https network-manager nano sudo
useradd -m -G video,render,sudo,dialout -s /bin/bash pi
passwd pi
# edit /etc/fstab
/dev/mmcblk0p1 /boot vfat defaults 0 0
/dev/mmcblk0p2 / ext4 defaults,noatime,nodiratime 0 1
@44670
44670 / genpass.py
Last active November 2, 2019 08:06
import getpass
import base64
from hashlib import pbkdf2_hmac
pwd = getpass.getpass()
salt = raw_input('Salt:')
iters = 10000
hmac = pbkdf2_hmac(hash_name='sha256',password=pwd,salt=salt,iterations=iters)
@44670
44670 / lcd.py
Created April 17, 2017 06:44
lcd
#/usr/bin/python
#
# Written for PyUSB 1.0 (w/libusb 1.0.3)
#
import usb, sys # 1.0 not 0.4
import time
import psutil