Skip to content

Instantly share code, notes, and snippets.

@seifertk
seifertk / intelephense_patch.sh
Last active November 6, 2019 17:03
intelephense
#!/bin/sh
EXTENSIONS=/home/kyle/.vscode/extensions
find "$EXTENSIONS" -type f -iname "intelephense.js" -exec sh -c "\
printf 'Patching intelephense activation...'; \
sed -re 's/set activationResult\(e\)\s*\{[^\}]+\}/set activationResult(e){return true}/g' -i '{}';\
sed -re 's/isActive\(\)\s*\{[^\}]+\}/isActive(){return true}/g' -i '{}';\
sed -re 's/isRevoked\(\)\s*\{[^\}]+\}/isRevoked(){return false}/g' -i '{}';\
sed -re 's/isExpired\(\)\s*\{[^\}]+\}/isExpired(){return false}/g' -i '{}';\
@seifertk
seifertk / magnet2torrent
Created July 23, 2018 14:29
convert a magnet link to a .torrent file
#!/bin/bash
process()
{
[[ "$1" =~ xt=urn:btih:([^&/]+) ]] || exit 1;
echo "d10:magnet-uri${#1}:${1}e" > "meta-${BASH_REMATCH[1]}.torrent"
}
# if input is a file, perform on each line
if [ -f "$1" ]; then
@seifertk
seifertk / mysqlbackup.sh
Created May 14, 2018 13:13
perform backups / incremental backups of mysql database
#!/bin/sh
# mysqlbackup.sh
# performs full or diff backups of a mysql database
# The directory where backups live
DIR="/srv/media/.backup"
# The mysqldump command and parameters
MYSQL="/usr/bin/mysqldump --all-databases --single-transaction --events --routines --triggers"
@seifertk
seifertk / 4get.sh
Last active May 14, 2018 12:57
Grab all files of a certain extension from an image board
#!/bin/bash
NUM=0;
EXTENSIONS='webm|jpg';
if test -z "$1"; then
echo "no argument";
exit 1;
fi