Skip to content

Instantly share code, notes, and snippets.

@claudio4
claudio4 / bookmarlet.js
Last active September 5, 2023 19:59
Bookmarklet to prevent sites from messing with the copy/paste events. Executing it a second time restore the sites normal behavior
(function () {
function showModal(message) {
const main = document.createElement('div');
main.style.position = 'fixed';
main.style.top = '16px';
main.style.width = '80vw';
main.style.left = '50%';
main.style.transform = 'translateX(-50%)';
main.style.maxWidth = '800px';
main.style.backgroundColor = 'rgba(255, 218, 121,0.8)';
#include <errno.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
int fd[2];
@claudio4
claudio4 / build_nginx.sh
Last active April 18, 2021 22:04
Download & Build Nginx with OpenSSL and PCRE with version selector
#!/usr/bin/env bash
if [ "$1" == "" ] || [ "$2" == "" ] || [ "$3" == "" ]; then
>&2 echo "No enough arguments provided. use ./build_nginx.sh nginx-version PCRE-version openssl-version [install]"
exit 1
fi
if [ "$4" == "yes" ]; then
INSTALL='yes'
else
INSTALL='no'
fi
@claudio4
claudio4 / telica
Last active July 17, 2020 19:06
Telica
#!/bin/bash
if [ -z "$TG_CHAT_ID" ]; then
echo '$TG_CHAT_ID is not defined' >&2
exit 1
fi
if [ -z "$TG_BOT_TOKEN" ]; then
echo '$TG_BOT_TOKEN is not defined' >&2
exit 1
fi
if [ -z "$*" ]; then
@claudio4
claudio4 / README.md
Last active December 5, 2019 23:52
Minecraft Systemd service

Based on chungy's system service

Place minecraft@.service in /lib/systemd/system, and run systemctl daemon-reload. mc-< your server name > should go into /etc/conf.d or an equivalent directory (change the path in the service too). /etc/conf.d/mc-<your server name> should not have world permissions. chown root:root and chmod 600 the file. Your server should be at /opt/minecraft/<your server name> and your server executable should be called server.jar.

The user and group minecraft should exist. The minecraft user should only be a member of the minecraft group, for system security. The service is set up as such that security exploits of the Minecraft server and/or Java do not severely affect the rest of the system. /home is entirely inaccessible, /tmp and /var/tmp are sandboxed, no real device access is possible, and system directories like /etc cannot be written to. This takes hold even if there are otherwise file modes that would allow

@claudio4
claudio4 / hs.reg
Created April 4, 2019 20:44
Share directory with HS (WIndows)
Windows Registry Editor Version 5.00
; Replace C:\\Program Files\\CLI\\hs.exe with the route to your hs binary
[HKEY_CLASSES_ROOT\Directory\shell\hs]
@="Serve folder with HS"
[HKEY_CLASSES_ROOT\Directory\shell\hs\command]
@="\"C:\\Program Files\\CLI\\hs.exe\" \"%1\""
[HKEY_CLASSES_ROOT\Directory\Background\shell\hs]
@="Serve folder with HS"
[HKEY_CLASSES_ROOT\Directory\Background\shell\hs\command]
@claudio4
claudio4 / lexicon.hook.sh
Created April 1, 2017 17:57
Lexicon hook based on example hook of Analogj 's lexicon repository
#!/usr/bin/env bash
#
# lexicon hook for dehydrated
set -e
set -u
set -o pipefail
export PROVIDER=${PROVIDER:-"cloudflare"}
@claudio4
claudio4 / keybase.md
Created March 6, 2017 13:38
KeyBase verification

Keybase proof

I hereby claim:

  • I am claudio4 on github.
  • I am claudio4 (https://keybase.io/claudio4) on keybase.
  • I have a public key whose fingerprint is C998 6889 86B2 9D4B FE83 58A0 4410 8070 D1D8 9AFE

To claim this, I am signing this object:

@claudio4
claudio4 / sc-pxl-hook.sh
Created January 21, 2017 18:34
PXL.LT Hook for ScreenCloud
PXLKEY='YOUR pxl.lt key'
curl -s \
-F "file=@$1" \
-F "upload-key=$PXLKEY" \
https://pxl.lt/screenshot/upload.php; echo
@claudio4
claudio4 / build_nginx.sh
Last active December 6, 2019 19:15 — forked from Belphemur/build_nginx.sh
Compiling Nginx with LibreSSL (and http2)
#!/usr/bin/env bash
if [ "$1" == "" ] || [ "$2" == "" ] || [ "$3" == "" ]; then
>&2 echo "No enough arguments provided. use ./build_nginx.sh nginx-version PCRE-version libressl-version"
exit 1
fi
# names of latest versions of each package
export NGINX_VERSION=$1
export VERSION_PCRE="pcre-$2"
export VERSION_LIBRESSL="libressl-$3"
export VERSION_NGINX=nginx-$NGINX_VERSION