Skip to content

Instantly share code, notes, and snippets.

@non7top
non7top / git-branch-cleaner
Created May 10, 2023 18:07 — forked from jdhoek/git-branch-cleaner
Bash script for cleaning up old git branches from local and remote repositories
View git-branch-cleaner
#!/bin/bash
ME=$(basename $0)
function showHelp {
cat << EOF
Clean-up old git branches
Usage: $ME local show-last [AGE_IN_WEEKS]
$ME remote show-last REMOTE [AGE_IN_WEEKS]
@non7top
non7top / upload.php
Created April 13, 2022 11:32 — forked from taterbase/upload.php
Simple file upload in php
View upload.php
<!DOCTYPE html>
<html>
<head>
<title>Upload your files</title>
</head>
<body>
<form enctype="multipart/form-data" action="upload.php" method="POST">
<p>Upload your file</p>
<input type="file" name="uploaded_file"></input><br />
<input type="submit" value="Upload"></input>
@non7top
non7top / remove_crw.cmd
Created February 6, 2020 00:41 — forked from xvitaly/remove_crw.cmd
Remove telemetry updates for Windows 7 and 8.1
View remove_crw.cmd
@echo off
echo Uninstalling KB3075249 (telemetry for Win7/8.1)
start /w wusa.exe /uninstall /kb:3075249 /quiet /norestart
echo Uninstalling KB3080149 (telemetry for Win7/8.1)
start /w wusa.exe /uninstall /kb:3080149 /quiet /norestart
echo Uninstalling KB3021917 (telemetry for Win7)
start /w wusa.exe /uninstall /kb:3021917 /quiet /norestart
echo Uninstalling KB3022345 (telemetry)
start /w wusa.exe /uninstall /kb:3022345 /quiet /norestart
echo Uninstalling KB3068708 (telemetry)
@non7top
non7top / remove-win10-spyware.bat
Created February 6, 2020 00:41 — forked from zorchenhimer/remove-win10-spyware.bat
Remove all the nasty stuff that was backported to Windows 7 and 8 from Windows 10.
View remove-win10-spyware.bat
@echo off
AT > NUL
if %ERRORLEVEL% EQU 1 (
echo Error: Not running as administrator.
echo Please right click the batch file and select 'Run as Administrator'
exit /b 1
)
echo Uninstalling bad updates...
@non7top
non7top / print_to_pdf.bas
Created September 5, 2019 20:14
LibreOffice Calc macros to print selected pages into pdf
View print_to_pdf.bas
sub print_to_pdf2
if len(ThisComponent.getURL())=0 then
msgbox "Save document first!"
exit sub
end if
If (Not GlobalScope.BasicLibraries.isLibraryLoaded("Tools")) Then
GlobalScope.BasicLibraries.LoadLibrary("Tools")
End If
@non7top
non7top / dump_http_headers.sh
Created June 15, 2019 15:08
dump_http_headers
View dump_http_headers.sh
# https://serverfault.com/a/633452
stdbuf -oL -eL /usr/sbin/tcpdump -A -s 10240 -i lo "tcp port 82 and (((ip[2:2] - ((ip[0]&0xf)<<2)) - ((tcp[12]&0xf0)>>2)) != 0)" | egrep -a --line-buffered ".+(GET |HTTP\/|POST )|^[A-Za-z0-9-]+: " | perl -nle 'BEGIN{$|=1} { s/.*?(GET |HTTP\/[0-9.]* |POST )/\n$1/g; print }'
@non7top
non7top / check_http_wget
Created February 12, 2019 00:06
nagios site check, uses curl
View check_http_wget
#!/bin/bash
exec 2>&1
[ -d /dev/shm -a -w /dev/shm ] && export TMPDIR=/dev/shm
# Parsing Input Parameters {{{
#####################################################################
allparams=$*
g_myname_pid=$$
@non7top
non7top / recode.sh
Created September 8, 2018 11:47 — forked from cstroie/recode.sh
Recode MP3 files with normalization
View recode.sh
#!/bin/bash
#
# recode
#
# Copyright 2011 Costin STROIE <costinstroie@eridu.eu.org>
#
@non7top
non7top / super-tip.txt
Created January 18, 2018 19:11 — forked from ericdouglas/super-tip.txt
Change 4 spaces to 2 spaces indentation and change tab to spaces - Vim tip
View super-tip.txt
// 4 spaces to 2 spaces
%s;^\(\s\+\);\=repeat(' ', len(submatch(0))/2);g
// Tab to 2 spaces
:%s/\t/ /g
@non7top
non7top / nginx-lua-s3.nginxconf
Created January 14, 2018 21:51 — forked from raucao/nginx-lua-s3.nginxconf
Nginx proxy to S3
View nginx-lua-s3.nginxconf
location ~* ^/s3/(.*) {
set $bucket '<REPLACE WITH YOUR S3 BUCKET NAME>';
set $aws_access '<REPLACE WITH YOUR AWS ACCESS KEY>';
set $aws_secret '<REPLACE WITH YOUR AWS SECRET KEY>';
set $url_full "$1";
set_by_lua $now "return ngx.cookie_time(ngx.time())";
set $string_to_sign "$request_method\n\n\n\nx-amz-date:${now}\n/$bucket/$url_full";
set_hmac_sha1 $aws_signature $aws_secret $string_to_sign;
set_encode_base64 $aws_signature $aws_signature;