Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python3
"""
Test Python
Write a function that builds a tree based on a list of tuples of id (parent id, offspring id),
where None is the id of the root node.
How this should work:
"""
@hjltu
hjltu / decoder.sh
Last active January 6, 2022 13:17
Video decoder
#!/usr/bin/env bash
# help set
set -e
CURR_DIR=${PWD##*/}
FILENAME=${1}
NEWRESOLUTION="${2:-1260:720}"
NEWFRAMERATE="${3:-24}"
THREADS="${4:-1}"
@hjltu
hjltu / finnix123 help
Last active January 2, 2022 10:33
finnix123 help
# enable ssh service, /etc/ssh/sshd_config.d/finnix.conf
passwd
service ssh restart
@hjltu
hjltu / gen-ppm.sh
Last active January 2, 2022 10:35
Generate image
#!/bin/bash
exec > my_image.ppm # output file
echo "P3 250 250 255" # format, width, high, max color depth
for ((y=0; y<250; y++)) {
for ((x=0; x<250; x++)) {
#echo "$((x^y)) $((x^y)) $((x|y))" # r, g, b # black & blue
#echo "$((x)) $((y)) $((x|y))" # r, g, b # color
echo "$((x)) $((y)) $((x^y))" # r, g, b # bright color
@hjltu
hjltu / .vimrc
Last active January 2, 2022 10:36
vim config file
"ignore vim -u ~/.vimrc
"set autoindent
"set smartindent
syntax on
set number
set nowrap
set expandtab
set tabstop=4
set shiftwidth=4
set showtabline=2
@hjltu
hjltu / emoji.sh
Last active August 14, 2021 22:23
emogi for bash prompt
#!/bin/bash
function my_emj()
{
EMOJIS=(๐Ÿฆ† ๐Ÿฆ‰ ๐Ÿฅ“ ๐Ÿฆ„ ๐Ÿฆ€ ๐Ÿ–• ๐Ÿฃ ๐Ÿค ๐Ÿฅ ๐Ÿก ๐Ÿฅƒ ๐Ÿฅž ๐Ÿคฏ ๐Ÿคช ๐Ÿคฌ ๐Ÿคฎ ๐Ÿคซ ๐Ÿคญ ๐Ÿง ๐Ÿ• ๐Ÿฆ– ๐Ÿ‘พ \
๐Ÿ‰ ๐Ÿ“ ๐Ÿ‹ ๐ŸŒ ๐Ÿข ๐ŸŽƒ ๐ŸŽ€ ๐ŸŽ ๐Ÿป ๐Ÿท ๐Ÿญ ๐Ÿจ ๐Ÿฟ ๐Ÿ ๐Ÿง ๐Ÿฆ ๐Ÿ‘‘ ๐Ÿ‘น ๐Ÿ‘บ ๐Ÿ‘ป ๐Ÿ‘ฝ ๐Ÿ’€ ๐Ÿ’– ๐Ÿ’ฉ ๐Ÿ’ฐ \
๐Ÿ˜ฑ ๐Ÿ™„ ๐Ÿ™ƒ ๐Ÿง™ โ›„ ๐Ÿฐ ๐ŸŽ… ๐Ÿž ๐Ÿ ๐Ÿค– ๐Ÿค— ๐ŸŽฒ)
EMJ=${EMOJIS[$RANDOM % ${#EMOJIS[@]}]};
echo $EMJ
}
#!/usr/bin/env python3
"""fib.py fibonacci numbers
usage: python3 fib.py """
import sys
def main(mx=99):
fib=[1, 1, 0]
#!/usr/bin/env python3
"""
convert rgb to hsv
usage: python3 rgb2hsv.py "FF9D30FF"
homekit.json
#include <ESP8266WiFi.h>
#include <PubSubClient.h>
const char *ssid = "name";
const char *pass = "pass";
WiFiClient wclient;
IPAddress mqtt_server(192,168,0,20);
PubSubClient client(wclient, mqtt_server);
@hjltu
hjltu / gist:597b1047cd3ed1d264457791b023a966
Last active November 30, 2017 23:24
My Python lib for sqlite3 operations
#!/usr/bin/env python
"""20/10/2017 - 30/11/2017 hjltu@ya.ru
github = https://gist.github.com/hjltu/597b1047cd3ed1d264457791b023a966.js
mydp.py contain methods for sqlite3 operations:
create() - create new table
options not requared *
drop() - drop table
options not requared *