This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
shopt -s nullglob | |
ssids=("/etc/NetworkManager/system-connections/*") | |
for ssid in ${ssids[@]}; do | |
ssid_name=${ssid##*/} | |
printf "\e[1m$ssid_name\e[0m : " | |
password=$(cat "$ssid" | grep "psk=" | cut -c 5-) | |
if [ -z "$password" ]; then | |
echo -e "\e[91mNo password\e[39m" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
echo "Hostname is: $(hostname)" | |
echo "Public IP address is: $(dig +short myip.opendns.com @resolver1.opendns.com)" | |
echo "Private IP addresses are: $(hostname -I | sed 's/ /, /g' | sed 's/.\{2\}$//')" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env bash | |
mainBranch=$1 | |
remote=$2 | |
sudo rm -r .git && git init && git remote add origin $remote && git add --all && git commit -m "first commit" -a && git push -u origin $mainBranch --force |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
import subprocess | |
import sys | |
print(re.findall(r"(?<=rate: ).+(?=\n)", | |
subprocess.run(["ffmpeg", "-i", sys.argv[1]], stderr=subprocess.PIPE).stderr.decode())[0]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import pwd | |
def demote_to_caller(): | |
if os.geteuid() == 0: | |
d = pwd.getpwnam(os.environ["SUDO_USER"]) | |
os.setgid(d.pw_gid) | |
os.setuid(d.pw_uid) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import argparse | |
import subprocess | |
parser = argparse.ArgumentParser() | |
parser.add_argument("file", help="file to split") | |
parser.add_argument("name_and_time", type=lambda x: x.rsplit( | |
"_", 1), nargs="+", help="[name]_[time to split on]") | |
args = parser.parse_args() | |
file_extension = args.file.split(".")[-1] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random | |
from itertools import chain, product | |
from json.decoder import JSONDecodeError | |
from time import sleep | |
import requests | |
from selenium import webdriver | |
JACKBOX_URL = "https://ecast.jackboxgames.com/room/" | |
USERNAME = "A GHOST" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
out=$(curl "http://httpbin.org/get?key=value" -w "%{http_code}\\n" -sS) | |
sc=$(echo "$out" | tail -n -1) | |
json=$(echo "$out" | sed \$d) | |
echo -e "STATUS CODE:\n$sc\n\nJSON:\n$json" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Bing Video to Source Page | |
// @version 1.0 | |
// @description redirect straight to source page when clicking on a Bing video link | |
// @author Zeke Marffy | |
// @match https://www.bing.com/videos/* | |
// @grant none | |
// ==/UserScript== | |
(function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set d to text returned of (display dialog "Enter a date in %m%d%Y format (example: 01122020 for January 12, 2020)" default answer "" buttons {"Cancel", "Continue"} default button "Continue") | |
set trackFileList to {} | |
tell application "Music" | |
repeat with t in selection | |
set trackInfo to {} | |
copy POSIX path of (get location of t) to the end of trackInfo | |
copy (get played count of t) to the end of trackInfo | |
copy trackInfo to the end of trackFileList | |
end repeat |
OlderNewer