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 pychrome | |
# NOT WORKING, copied FTR as copy for "later" from: | |
# from https://stackoverflow.com/a/61311648/544721 | |
def save_image(file_content, file_name): | |
try: | |
file_content=base64.b64decode(file_content) | |
with open("C:\\Crawler\\temp\\" + file_name,"wb") as f: |
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
#![allow(dead_code)] | |
// playground: https://gist.github.com/rust-play/6d697a29901d4b82cc8b184526d4b8f1 | |
fn all_postfixes_sorted(arr: &[&str]) -> Vec<String> { | |
let mut postfixes: std::collections::HashSet<String> = std::collections::HashSet::new(); | |
for &w in arr { | |
for start_idx in 0..(w.chars().count()) { | |
let slice: &str = &w[start_idx..]; | |
let w = String::from(slice); |
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
#![allow(dead_code)] | |
// https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=bda017580640d3b70ea211bec7e9038b | |
// Task: sorted postfixes for given list of strings | |
// Example: bcd -> bcd,cd,d | |
// Example: abc,bcd,xyz -> abc,bc,bcd,c,cd,d,xyz,yz,z | |
fn all_postfixes_sorted(arr: &[&str]) -> Vec<String> { | |
let mut postfixes: std::collections::HashSet<String> = std::collections::HashSet::new(); | |
for &w in arr { |
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 | |
# https://gist.github.com/gwpl/badde4515f383665da640a2c6f98ff7a | |
# | |
# In directory with Dockerfile , you just use : | |
# $ docker-run.sh command... | |
# to run command inside dockerfile. Image hash etc will be automatically identified. | |
if [ -z "$0" ]; then | |
cat <<E |
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 archlinux:latest | |
RUN pacman -Syyu --noconfirm | |
RUN pacman -S --noconfirm git | |
RUN pacman -S --noconfirm vim screen | |
RUN pacman -S --noconfirm base-devel | |
RUN pacman -S --noconfirm go go-tools | |
RUN pacman -S --noconfirm wget aria2 mc cmatrix htop vim | |
RUN git clone https://aur.archlinux.org/pacaur.git | |
#RUN set -x ; mkdir /home/nobody && chown -v nobody:nobody /home/nobody && cd /home/nobody/ && sudo -u nobody git clone https://aur.archlinux.org/pacaur.git && cd pacaur/ && sudo -u nobody makepkg -si |
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 archlinux:latest | |
RUN pacman -Syyu --noconfirm | |
RUN pacman -S --noconfirm git | |
RUN pacman -S --noconfirm vim screen | |
RUN pacman -S --noconfirm base-devel | |
RUN pacman -S --noconfirm go go-tools | |
RUN pacman -S --noconfirm wget aria2 mc cmatrix htop vim | |
RUN git clone https://aur.archlinux.org/pacaur.git | |
#RUN set -x ; mkdir /home/nobody && chown -v nobody:nobody /home/nobody && cd /home/nobody/ && sudo -u nobody git clone https://aur.archlinux.org/pacaur.git && cd pacaur/ && sudo -u nobody makepkg -si |
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
My Telegram was opening pdf-s in Mendeley instead of pdf reader, | |
(even most other apps open it in pdf reader, xdg-open etc...), | |
so I checked what's going on: | |
sf=$(mktemp --suffix=.strace.fifo) | |
#mkfifo "$sf" | |
echo "sf=$sf" | |
strace -o "$sf" -f telegram-desktop >/dev/null 2>/dev/null #&& rm -v "$sf" | |
# other terminal for clear output | |
sf=to_be_same_like_in_other_terminal |
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
[package] | |
name = "profiling_test" | |
version = "0.1.0" | |
authors = ["root <root@localhost>"] | |
edition = "2018" | |
[dependencies] | |
profiling = "0.1" | |
tracy-client = { version = "0.10", optional = true } |
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
function dockershell() { | |
docker run --rm -i -t --entrypoint=/bin/bash "$@" | |
} | |
function dockershellsh() { | |
docker run --rm -i -t --entrypoint=/bin/sh "$@" | |
} | |
function dockershellhere() { | |
dirname=${PWD##*/} |
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
# IE is still braindead so still use favicon.ico | |
convert -resize x16 -gravity center -crop 16x16+0+0 -flatten -colors 256 input.png output-16x16.ico | |
convert -resize x32 -gravity center -crop 32x32+0+0 -flatten -colors 256 input.png output-32x32.ico | |
convert output-16x16.ico output-32x32.ico favicon.ico | |
# Then, HTML needs to specify size="XxY" as largest size due to browser bugs | |
<link rel="shortcut icon" href="/favicon.ico" sizes="32x32"> |