Skip to content

Instantly share code, notes, and snippets.

@yfe404
yfe404 / arch.sh
Created January 12, 2022 19:48
arch-setup
systemctl enable sshd ; systemctl start sshd
# select relevant servers in /etc/pacman.d/mirrorlist according to your location
# initialise keyring
pacman-key --init
# initial setup of keys
pacman-key --populate archlinux
# update everything (should be done regularly)
pacman -Sy archlinux-keyring && pacman -Su
@yfe404
yfe404 / wip.txt
Created November 26, 2021 11:29
Send encrypted files anonymously using pastebin
Pre-conditions
--------------
- The following packages must be installed on both ends: gpg, xxd.
- Sender and Receiver must know the password to encrypt/decrypt the data.
Sender
------
$ gpg --symmetric $FILE_TO_SEND
@yfe404
yfe404 / ddpv.sh
Created November 2, 2021 06:46
Monitor the progress of dd using pv (progress vue) utility
#!/bin/bash
DISK_IMAGE=~/Downloads/my-image.img
DISK=/dev/sdK
pv $DISK_IMAGE | sudo dd bs=4M of=$DISK
# This code is written at BigVision LLC. It is based on the OpenCV project. It is subject to the license terms in the LICENSE file found in this distribution and at http://opencv.org/license.html
# Usage example: python3 object_detection_yolo.py --video=run.mp4
# python3 object_detection_yolo.py --image=bird.jpg
import cv2 as cv
import argparse
import sys
import numpy as np
from urllib.request import urlopen
import os
@yfe404
yfe404 / my_tunnel.service
Last active July 3, 2020 12:31
Systemd service for ssh tunneling
[Unit]
Description="Establish a SSH tunnel to orion to map searx port to local 3337"
After=sshd.service
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=Always
RestartSec=1
User=yfe
for c in $(i3-msg -t get_bar_config | python -c \
'import json,sys;print("\n".join(json.load(sys.stdin)))'); do \
(i3bar --bar_id=$c >i3bar.$c.log 2>&1) & \
done;
cat i3bar.bar-*.log
i3-msg reload
i3-msg restart
@yfe404
yfe404 / nox.sh
Created July 10, 2019 20:08
Decrease screen brightness using xrandr
#!/bin/bash
b=$(xrandr --current --verbose | grep -i bright | cut -d':' -f 2)
b=$((b - 0.1))
xrandr --output eDP-1 --brightness $b ## adjust the output with yours, you can get it using the commend xrandr (with no args)
@yfe404
yfe404 / lumos.sh
Created July 10, 2019 20:07
Increase screen brightness using xrandr
#!/bin/bash
b=$(xrandr --current --verbose | grep -i bright | cut -d':' -f 2)
b=$((b + 0.1))
xrandr --output eDP-1 --brightness $b ## adjust the output with yours, you can get it using the commend xrandr (with no args)
@yfe404
yfe404 / auto_reverse_shell.sh
Created July 8, 2019 10:04
Create a persistent reverse shell
IDENTITY="$USER/.ssh/identity.pem"
SRC_PORT=19999
DST_PORT=22
DST_USER=gandalf
DST_HOST=120.88.7.11
autossh -M 0 -N -o ServerAliveInterval 15 -i $IDENTITY -R $SRC_PORT:localhost:$DST_PORT $DST_USER@$DST_HOST
## You can connect back from DST_HOST using ssh -p $SRC_PORT local_user_on_SRC@localhost