Skip to content

Instantly share code, notes, and snippets.

@scottj
scottj / mount-shared-folders.sh
Last active April 17, 2024 22:23 — forked from mgeeky/mount-shared-folders.sh
VMware mount shared folders (taken from Kali)
#!/bin/bash
sudo -v || exit
vmware-hgfsclient | while read folder; do
echo "[i] Mounting ${folder} (/mnt/hgfs/${folder})"
sudo mkdir -p "/mnt/hgfs/${folder}"
sudo umount -f "/mnt/hgfs/${folder}" 2>/dev/null
sudo vmhgfs-fuse -o allow_other -o auto_unmount ".host:/${folder}" "/mnt/hgfs/${folder}"
done
@scottj
scottj / update-awscli.bash
Created November 25, 2023 20:35
Update AWS CLI
#!/usr/bin/env bash
URL=https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip
AWS=/usr/local/aws-cli
BIN=/usr/local/bin
TMP=$(mktemp -d /tmp/update-awscli.XXXXXX)
ZIP=$TMP/awscli.zip
echo [+] Downloading $URL
curl -so $ZIP $URL
@scottj
scottj / unprotect.sh
Last active February 17, 2023 21:02
Unprotect Excel Files
#!/usr/bin/env bash
if [[ $# -lt 2 ]]; then printf "Usage:\n$0 <src> <dst>\n"; exit; fi
function abspath { # https://stackoverflow.com/a/23002317/226502
if [[ -d $1 ]]; then (cd "$1"; pwd)
else
if [[ $1 = /* ]]; then echo "$1"
elif [[ $1 == */* ]]; then echo "$(cd "${1%/*}"; pwd)/${1##*/}"
else echo "$(pwd)/$1"
@scottj
scottj / music-search.bash
Last active April 17, 2024 21:55
Search Music.app on macOS
#!/bin/bash
QUERY=$1
# https://stackoverflow.com/a/246128/226502
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
/usr/bin/osascript ${SCRIPT_DIR}/music-search.scpt "${QUERY}"
curl -sx 127.0.0.1:8080 http://burp/cert \
| openssl x509 -inform DER \
| sudo tee /usr/local/share/certificates/burp.crt \
&& sudo update-ca-certificates
@scottj
scottj / bbedit-default-editor.sh
Created February 8, 2021 21:32
set BBEdit to default text editor on macOS
#!/bin/sh
defaults write com.apple.LaunchServices/com.apple.launchservices.secure LSHandlers \
-array-add '{LSHandlerContentType=public.plain-text;LSHandlerRoleAll=com.barebones.bbedit;}'
@scottj
scottj / Server.py
Last active February 9, 2023 14:25 — forked from HaiyangXu/Server.py
A simple Python HTTP server that can handle mime types properly.
#!/usr/bin/env python3
import http.server
import socketserver
HOST = "localhost"
PORT = 8000
class HttpRequestHandler(http.server.SimpleHTTPRequestHandler):
@scottj
scottj / keybase.md
Created November 19, 2019 19:40
Keybase proof

Keybase proof

I hereby claim:

  • I am scottj on github.
  • I am ssjx (https://keybase.io/ssjx) on keybase.
  • I have a public key ASBVMMgdcp7t8oByKF5zz7IIpCrXmTP6QbHnnsAAlakbxAo

To claim this, I am signing this object:

@scottj
scottj / build.xml
Created July 26, 2015 20:35
Build dex2jar.jar from a d2j snapshot
<project name="dex2jar" basedir="." default="build.jar">
<property name="lib.dir" value="lib"/>
<property name="build.dir" value="build"/>
<property name="dist.dir" value="dist"/>
<property name="dist.jar" value="${dist.dir}/dex2jar.jar"/>
<target name="init" description="Create Directories">
<mkdir dir="${build.dir}"/>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${lib.dir}"/>