Skip to content

Instantly share code, notes, and snippets.

View researcx's full-sized avatar
💼
Looking for work

Keira T. researcx

💼
Looking for work
View GitHub Profile
@researcx
researcx / dnsbl.php
Created December 22, 2018 10:29
dnsbl style blocking script (2016)
<?php
function CheckIfSpambot($emailAddress, $ipAddress, $userName, $debug = false)
{
$spambot = false;
$errorDetected = false;
if ($emailAddress != "")
{
$xml_string = file_get_contents("http://www.stopforumspam.com/api?email=" . urlencode($emailAddress));
$xml = new SimpleXMLElement($xml_string);
@researcx
researcx / scan_pics.php
Created December 22, 2018 10:30
mass image scanner (2008)
<?php
//scan_pics.php
//Mass image scanner for URLs.
//Valid known prefixes: DSC, DSCN, DSCF, DSC_, DSC, IMG, IMG_, Photo, PIC
//Valid suffixes: .jpg, .png (etc, keep in mind on linux servers file names are case sensitive, so searching for .JPG, .PNG may be useful, but cameras usually save them as lowercase .jpg), _DSCN.jpg (in rare cases)
//For more suffixes or prefixes read up on http://en.wikipedia.org/wiki/Design_rule_for_Camera_File_system
//Optimal usage: /scan_pics.php?url=http://filesmelt.com/dl/&prefix=DSC&suffix=.jpg
//You must edit the URL to your own likings.
@researcx
researcx / sshd_config
Created January 3, 2019 20:00
Hardened OpenSSH Server Config
# Hardened sshd_config by Kei (https://kei.a52.io/)
# This config was made for personal use. If you're going to use it, edit it to your likings or be locked out forever.
# THIS MAY BECOME OUTDATED OR MAY END UP NOT BEING SECURE AT ALL, USE AT YOUR OWN RISK
# Summary:
# Protocol 2 used by default.
# Port 2244 used by default.
# Only selected users in AllowUsers may log in.
# Root can only log in using key authentication by default (change PermitRootLogin to yes if you want to allow root with passwords).
# X11 Forwarding is disabled by default.
@researcx
researcx / simple_bash_uploader.sh
Created January 3, 2019 20:00
Simple bash uploader
#!/bin/sh
# Simple Bash Uploader (simple-bash-upload.sh)
# by kei - https://kei.a52.io/
# This will upload a file/screenshot to a server of your choice and automatically copy you the direct link to it.
# Supports regular file uploading + full-screen, active window and selected area screenshots.
# Usage: simple-bash-upload.sh [full|active|selection|filename.ext]
# Can be used directly from console to upload files (./simple-bash-upload.sh file.png) or assigned to a custom action in Thunar (./simple-bash-upload.sh %f)
# Can also be bound to run on certain keypresses such as print screen, alt+print screen and ctrl+print screen.
@researcx
researcx / git-update.sh
Created January 3, 2019 20:00
Git auto-update
#!/bin/sh
REPO="https://github.com/<user>/<repo>"
PATH="/path/to/repository"
LATEST=`/usr/bin/git ls-remote $REPO refs/heads/master | /usr/bin/cut -f 1`
CURRENT=`/usr/bin/git -C $PATH rev-parse HEAD`
echo "Current Revision: $CURRENT"
echo "Latest Revision: $LATEST"
@researcx
researcx / .bashrc
Last active January 9, 2019 18:11
Random shell aliases I use
# this is not a full .bashrc file!
# copy aliases you want or need for your own .bashrc
# some of these aliases will also easily work in other shells such as fish! (~/.config/fish/config.fish)
# reload bashrc
alias rl='. ~/.bashrc' #reload .bashrc
# info/find/usful
alias psg="ps aux | grep" # usage: psg <process name> - quick ps grep.
alias hsg="history | grep" # usage: hsg <string> - quick history grep.
@researcx
researcx / arch-linux-install.sh
Last active January 10, 2019 19:51 — forked from mattiaslundberg/arch-linux-install
Minimal instructions for installing Arch Linux on GPT or MBR on UEFI or Legacy BIOS
# Download an Arch ISO from https://www.archlinux.org and copy it to a USB drive:
sudo dd bs=4M if=archlinux-2019.01.01-x86_64.iso of=/dev/sdb status=progress oflag=sync
# then plug it into the device of your preference, boot it and start the installation process.
# Installation process:
# Set UK keymap
loadkeys uk
# Set up partitions (MBR)
parted /dev/sdX mklabel msdos
@researcx
researcx / download_docs.sh
Last active January 5, 2020 12:17
Download documentation for offline viewing
# Download documentation
wget https://docs.python.org/2/archives/python-2.7.15-docs-html.zip
wget https://docs.python.org/3/archives/python-3.8.0-docs-html.zip
wget https://downloads.mysql.com/docs/refman-8.0-en.html-chapter.zip
wget https://www.gnu.org/software/bash/manual/bashref.html
wget https://raw.githubusercontent.com/a8m/go-lang-cheat-sheet/master/README.md -O go-lang-cheat-sheet.md
wget https://www.golang-book.com/public/pdf/gobook.pdf
wget http://zeus.nyf.hu/~bajalinov/my_special/SW/C%23%203.0%20-%20The%20Complete%20Reference%20-%20Herbert%20Schildt.pdf
wget http://zeus.nyf.hu/~bajalinov/my_special/SW/C%23%20Bible.pdf
@researcx
researcx / redir-uredir-quickbuild.sh
Created February 2, 2020 21:34
redir and uredir quick build
sudo dnf -y groupinstall "Development Tools"
mkdir /src
cd /src
#redir
git clone https://github.com/troglobit/redir.git
cd redir
./autogen.sh
./configure
make -j5
@researcx
researcx / dd-alias.sh
Created April 23, 2020 18:49
bash dd confirmation function/alias for those who need it
function dd () {
local bold=$(tput bold)
local normal=$(tput sgr0)
local red=$(tput setaf 1)
local green=$(tput setaf 2)
local yellow=$(tput setaf 3)
local ddcommand=$(which dd)
local vars=""