Skip to content

Instantly share code, notes, and snippets.

View b-'s full-sized avatar
❄️
learning nix

bri b-

❄️
learning nix
View GitHub Profile
@b-
b- / json.json
Last active July 8, 2019 20:06 — forked from EvaLovlac3/json.json
[
{
"type": "A",
"name": "@",
"value": "SOMEIP"
},
{
"type": "A",
"name": "*",
"value": "SOMEIP"
@b-
b- / keybase.md
Created June 19, 2019 18:33
keybase.md

Keybase proof

I hereby claim:

  • I am b- on github.
  • I am bri_ (https://keybase.io/bri_) on keybase.
  • I have a public key ASBsq_j5i0cOXxjgON7NuwkNg9RmTt333Pl5FGLOqXhwNgo

To claim this, I am signing this object:

@b-
b- / decrement mouse speed.applescript
Created October 30, 2017 18:41
Increment/Decrement Mouse speed
use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
set trackingDelta to -1 --decrease
--Open and activate System Preferences
tell application "System Preferences" to activate
--Attempt to change settings using System Events
tell application "System Events"
tell process "System Preferences"
@b-
b- / Name-of-ps1.bat
Created August 21, 2017 04:52
PowerShell batch glue
:: I didn't do any testing on this. In fact, I typed it on my iPhone. There is probably something wrong with it. But I've typed this so many times I have muscle memory, hence my putting it up here.
:: Name this file (ps1-file-without-extension).bat, so if you have a script "myscript.ps1" you'd name this file "myscript.bat"
:: Flags and shit are optional. Read the PowerShell manual for more info. I think there's one called "windowstyle" or something which can be pretty useful.
:: n.b. this is a Windows batch file. Maybe I'm crazy, but I actually like PowerShell on *nix. However, this will not work on *nix.
:: I *think* that since PowerShell uses # to denote comments you could stick a shebang (e.g., `#!/usr/bin/powershell`) but I'm not sure if there really is a standardized install path, nor do I know if `#!/usr/bin/env powershell` would work, either. (Maybe I should give up powershell on *nix and just learn Python...)
::@echo off
set "flags=-executionPolicy bypass"
@b-
b- / wipeharddriveswithoutasking.ps1
Created December 2, 2016 19:27
Wipe "USB 3.0*" disks in PowerShell
## ## ### ######## ## ## #### ## ## ######
## ## ## ## ## ## ## ### ## ## ### ## ## ##
## ## ## ## ## ## ## #### ## ## #### ## ##
## ## ## ## ## ######## ## ## ## ## ## ## ## ## ####
## ## ## ######### ## ## ## #### ## ## #### ## ##
## ## ## ## ## ## ## ## ### ## ## ### ## ##
### ### ## ## ## ## ## ## #### ## ## ######
# This script WILL unrecoverably erase any drives that meet the criteria directly below.
# It will not ask for permission.
# It's probably a bad idea.
@b-
b- / _deepsleep.sh.md
Last active September 4, 2018 03:38
Hibernate macOS computer

deepsleep.sh: hibernate macOS computer

There is no easy way to hibernate a macOS computer on demand. This utility fixes that problem. This command must be run as root, but there's an easy way to fix that:

  • Copy deepsleep.sh to a folder, such as /usr/bin (In Terminal, type cp /PATH/TO/deepsleep.sh /usr/bin)
  • In Terminal, type: sudo visudo to edit the /etc/sudoers file. DO NOT edit this file with another command. If you do not like vi you can type export VISUAL=nano first to tell visudo to use nano
  • Add a line anywhere in the file (I recommend either the very beginning or very end) that says ALL ALL=NOPASSWD:/LOCATION/TO/deepsleep.sh (so, for example, ALL ALL=NOPASSWD:/usr/bin/deepsleep.sh)
  • Run the command using sudo /path/to/deepsleep.sh

WARNING:

If you wake the computer before it's finished hibernating, this script will leave it in a bad spot where it will hibernate every time you tell it to go to sleep. To fix this, type sudo pmset -a hibernatemode 3 or `sudo path/to/deeps

@b-
b- / makertf.bat
Last active September 6, 2016 21:47
make RTF from input ASCII text file
@echo off
set input="%~1"
set output="%~1.rtf"
::RTF header and font table (Courier New)
echo {\rtf1\ansi\deff0\nouicompat{\fonttbl{\f0\fnil\fcharset0 Courier New;}} > %output%
::page setup settings (landscape, legal, 0.5" margins)
echo \landscape >> %output%
::Paper width and height and margins in "twips", or 20ths of a point, or 1/1440ths of an inch
::So legal paper (oriented in landscape) would be (14 inches * 1440 twips in an inch)=20160 twips long
@b-
b- / exec.bat
Last active August 29, 2015 14:22
deluge execute script
:addtorrents %torrentid% %torrentname% %torrentpath%
::Copies any MP3 files, any M4A files, and any PDF files
::::(ONLY copies PDFs if MP3 and/or M4A files are found)
::::to the folder D:\autoadd, and adds a line to
::::%userprofile%\Music\deluge-script.log with the date/time of script run
setlocal
set torrentid=%1
set torrentname=%2
set torrentpath=%3
set "log=%userprofile%\Music\deluge-script.log"
@b-
b- / !!
Last active October 20, 2022 14:35 — forked from cmlsharp/!!
# Add this to your ~/.config/fish/config.fish
# Syntax:
# To just rerun your last command, simply type '!!'
# This forked version supports "sudo !!" via two functions.
function !!
eval $history[1] $argv
end function
function sudo
if test $argv