Skip to content

Instantly share code, notes, and snippets.

View tolgahanakgun's full-sized avatar
😛
( ͡ ͡° ͜ ʖ ͡ ͡°) \╭☞

Tolgahan Akgun tolgahanakgun

😛
( ͡ ͡° ͜ ʖ ͡ ͡°) \╭☞
View GitHub Profile
@tolgahanakgun
tolgahanakgun / relay_ssh_agent
Created March 28, 2023 17:24
Relay forwarded ssh-agent to docker
#!/bin/bash
set -ex
set -o pipefail
# THIS MUST BE USED WITH AN SSH-AGENT THAT SUPPORTS CONFIRMATION/NOTIFICATION UPON A SIGNATURE REQUEST.
# Mount the sock to the docker
# docker run --user $(id -u):$(id -g) --rm -it -v "$HOME/.ssh/sshsock:/sshsock" -e SSH_AUTH_SOCK=/sshsock/sock ubuntu bash
#!/usr/bin/env python3
"""Extend Python's built in HTTP server to save files
curl or wget can be used to send files with options similar to the following
curl -X PUT --upload-file somefile.txt http://localhost:8000
wget -O- --method=PUT --body-file=somefile.txt http://localhost:8000/somefile.txt
__Note__: curl automatically appends the filename onto the end of the URL so
the path can be omitted.
Windows upload & download
powershell -ep bypass -c "$wc=New-Object Net.WebClient;$wc.UploadFile('http://target.com/upload.bin', 'PUT', 'c:\\upload.bin');"
#!/bin/bash
wget -O /tmp/filegator_latest.zip https://raw.githubusercontent.com/filegator/static/master/builds/filegator_latest.zip
mkdir /tmp/filegator
unzip /tmp/filegator_latest.zip -d /tmp/filegator
cd /var/www/html/filegator
sudo find . ! -name . -prune ! -path ./private \
! -path ./repository \
! -path ./configuration.php \
#!/bin/bash
# download hosts file
wget -O /opt/adblock/hostfiles/someonewhocares.hosts https://someonewhocares.org/hosts/zero/hosts
wget -O /opt/adblock/hostfiles/winhelp2002.hosts http://winhelp2002.mvps.org/hosts.txt
wget -O /opt/adblock/hostfiles/tgccloud.hosts https://tgc.cloud/downloads/hosts.txt
wget -O /opt/adblock/hostfiles/stevensblack.hosts https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts
wget -O /opt/adblock/hostfiles/hblock.hosts https://hblock.molinero.dev/hosts
wget -O /opt/adblock/hostfiles/spotify_x0uid_spotifyablock.hosts https://raw.githubusercontent.com/x0uid/SpotifyAdBlock/master/hosts
wget -O /opt/adblock/hostfiles/spotify_saminnet_spotify_adblock_script.hosts https://raw.githubusercontent.com/saminnet/spotify-adblock-script/master/block.txt
Linux rock64 4.4.167-1213-rockchip-ayufan-g34ae07687fce #1 SMP Tue Jun 18 20:44:49 UTC 2019 aarch64 aarch64 aarch64 GNU/Linux
rock64@rock64:~$openssl speed -aead -evp aes-128-gcm
rock64@rock64:~$openssl speed -aead -evp aes-256-gcm
rock64@rock64:~$openssl speed -aead -evp chacha20-poly1305
type 2 bytes 31 bytes 136 bytes 1024 bytes 8192 bytes 16384 bytes
---- ------- -------- --------- ---------- ---------- -----------
aes-128-gcm 2326.81k 29137.11k 108788.53k 360005.63k 482115.58k 492399.27k
aes-256-gcm 2256.78k 28163.19k 102470.97k 320374.44k 420995.35k 423843.16k
chacha20-poly1305 807.76k 11608.37k 32482.65k 129967.34k 167075.84k 169951.23k
# create a folder with name .duckdns in the current user
# fill the domain and token fields in the code below
# then create a file with name duck.py and copy the lines starting with #!/usr/bin/python3
# chmod +x duck.py
# then create an entry in crontab with the line below
# */15 * * * * ~/.duckdns/duck.py >> ~/.duckdns/cron.log 2>&1
#!/usr/bin/python3
@tolgahanakgun
tolgahanakgun / DumpHex.c
Last active December 14, 2022 13:12 — forked from ccbrown/DumpHex.c
Compact C Hex Dump Function w/ASCII to buffer
#include <stdio.h>
void dump_hex(const void *data, size_t size, char *output)
{
char ascii[17];
size_t i, j;
ascii[16] = '\0';
for (i = 0; i < size; ++i)
{
openssl req -new -x509 -nodes -newkey ec:<(openssl ecparam -name prime256v1) -keyout cert.key -out cert.crt -days 365
// C program to illustrate
// non I/O blocking calls
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <fcntl.h> // library for fcntl function
#define MSGSIZE 16
char* msg1 ="hello";
char* msg2 ="bye !!";
"astyle.cmd_options": [
"--style=allman",
"--indent=spaces=4",
"--indent-col1-comments",
"--pad-oper",
"--pad-comma",
"--pad-header",
//"--style=1tbs",
"--attach-extern-c",
"--attach-closing-while",