π
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/bash | |
set -e | |
# https://stackoverflow.com/a/70438840 | |
declare -a files=() | |
declare -a arr=($(echo "$2" | tr "," " ")) | |
# splitting |
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
WITH tab AS ( | |
SELECT | |
a.attrelid::regclass::text AS t, | |
a.attname AS c, | |
pg_get_serial_sequence(a.attrelid::regclass::text, a.attname) AS s, | |
nextval(pg_get_serial_sequence(a.attrelid::regclass::text, a.attname)) AS v | |
FROM pg_attribute a | |
JOIN pg_class c ON c.oid = a.attrelid | |
WHERE | |
a.attrelid::regclass::text LIKE '%' |
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 django.apps import apps | |
HEADER = """@startuml | |
skinparam linetype ortho | |
""" | |
FOOTER = """@enduml""" | |
Models = apps.get_models() |
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
use std::fs::File; | |
use std::io::prelude::*; | |
const BYTES_PER_LINE: usize = 16; | |
fn main() { | |
let mut f= File::open("/tmp/file.txt").unwrap(); | |
let mut pos = 0; | |
let mut buffer = [0; BYTES_PER_LINE]; |
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/bash | |
ffmpeg \ | |
-f alsa -sample_rate 44100 -thread_queue_size 1024 -itsoffset -0.5 -i hw:0 \ | |
-f x11grab -r 30 -thread_queue_size 1024 -i :0.0 \ | |
-f v4l2 -r 30 -video_size 320x180 -thread_queue_size 1024 -i /dev/video0 \ | |
-filter_complex " | |
[1:v]scale=1920x1080[slides]; | |
[slides][2:v]overlay=x=1580:y=20 | |
" \ |
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 base64 | |
import hmac | |
import json | |
import secrets | |
def gen_token(key: bytes, data) -> str: | |
payload = json.dumps(data).encode() | |
mac = base64.urlsafe_b64encode(hmac.new(key, payload, "sha256").digest()) | |
return base64.urlsafe_b64encode(payload).decode() + "." + mac.decode() |
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
βββββββββββββββββ€βββββββββββββββ€ββββ | |
β Door β CLOSED β X β | |
βββββββββββββββββΌβββββββββββββββΌββββ’ | |
β Headphones β OFF β X β | |
βββββββββββββββββΌβββββββββββββββΌββββ’ | |
β Phone β SILENT β X β | |
βββββββββββββββββΌβββββββββββββββΌββββ’ | |
β Watch β SILENT β X β | |
βββββββββββββββββΌβββββββββββββββΌββββ’ | |
β Headset β ON β X β |
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
# Install ARCH Linux with encrypted file-system and UEFI | |
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description. | |
# Download the archiso image from https://www.archlinux.org/ | |
# Copy to a usb-drive | |
dd if=archlinux.img of=/dev/sdX bs=16M && sync # on linux | |
# Boot from the usb. If the usb fails to boot, make sure that secure boot is disabled in the BIOS configuration. | |
# Optionally set another keyboard layout. E.g. German |
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
data_dir = "/var/lib/vector" | |
# Sources | |
[sources.nginx_access_logs] | |
type = "file" | |
exclude = ["/var/log/nginx/error.log"] | |
include = ["/var/log/nginx/*.log"] | |
file_key = "log" | |
host_key = "server" |
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 *; | |
PyCon_Day = "3"; | |
while PyCon_Day == str(3): | |
print("It is "); | |
print("Monday"); | |
"""Tells us it's Monday"""; | |
def Need_Coffee(foo: Boolean): | |
if str(foo) == "True": |
NewerOlder