Skip to content

Instantly share code, notes, and snippets.

@jps3
jps3 / rpi-tv-switch.sh
Last active August 29, 2015 14:16
Raspberry Pi: 'tv off' and 'tv on' function
function tv () {
if (which tvservice fbset xrefresh 2>/dev/null); then
case "${1}" in
off|OFF|Off|0)
tvservice -o
;;
on|ON|On|1)
tvservice -p
fbset -depth 8
fbset -depth 16

Keybase proof

I hereby claim:

  • I am jps3 on github.
  • I am jps3 (https://keybase.io/jps3) on keybase.
  • I have a public key ASClk_9KO9x3CB1gDMgbQEemdF5zq47-JcQ2c-nV4dfghQo

To claim this, I am signing this object:

@jps3
jps3 / iptables-colorize.sed
Last active December 2, 2018 17:43
Colorize output from `iptables --line-numbers -nL` (`--list`) command
#!/bin/sed -Ef
# Adoption of nega0's gist as a standalone sed script
# https://gist.github.com/nega0/1d232622a1fa3dad176869bbfe747602
#
# Usage:
#
# $ sudo iptables --line-numbers -nL | ./iptables-colorize.sed
#
#!/bin/sh -e
#
# This was tested with Debian Linux 8 and 9
#
# (The arguments for the `last` command will not work with macOS/Darwin)
#
# $ last -adFi
# jps3 pts/0 Sun Dec 2 18:55:37 2018 still logged in 172.16.2.70
# XXXXXX pts/0 Sun Dec 2 17:23:21 2018 - Sun Dec 2 17:25:29 2018 (00:02) 10.10.219.245
function jamf_query_computer () {
name="${1:-myjamfcomputer}";
curl -X GET -sL -H 'Accept: application/json' --user "${JAMF_API_ROUSER}:${JAMF_API_PASSWORD}" https://${JAMF_INSTANCE}.jamfcloud.com/JSSResource/computers/match/${name}
}
jamf_query_computer_pretty () {
jamf_query_computer $* | jq -C .
}
@jps3
jps3 / force_ricoh_ri_100_reset.sh
Created April 12, 2019 17:14
The RICOH Ri 100 garment printer will cause its queue to be disabled by CUPS when jobs languish in the queue.
#!/bin/bash
# Used with chilcote/outset
# /usr/local/outset/login-privileged-every/force_ricoh_ri_100_reset.sh
PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin
PRINTER="RICOH_Ri_100"
logger -is "[$0] Cancelling all jobs for \"${PRINTER}\""
@jps3
jps3 / example-output.json
Last active October 8, 2019 18:43
jq: select dicts containing sub-dicts containing a key "b"
{
"a": {
"b": {
"key_1": "value_1"
}
},
"e": {
"b": {
"key_3": "value_3"
}
@jps3
jps3 / Vagrantfile
Last active March 31, 2020 18:10
Testing Adobe Creative Cloud Desktop App installation (before and after)
Vagrant.configure("2") do |config|
config.vm.define "win10-adobecc" do |win|
win.vm.box = "eval-win10x64-enterprise-ssh-saltlatest"
win.vm.hostname = "win10-adobecc"
win.vm.provider "vmware_desktop" do |v|
v.vmx["memsize"] = "2048"
v.vmx["numvcpus"] = "2"
v.gui = true
end
@jps3
jps3 / jamf200-s3l13t2-guest-account-status.sh
Last active December 16, 2020 19:28
Jamf 200 - Section 3 - Lesson 13 - Task 2 - Computer Extension Attribute
#!/bin/bash
#
# Checks whether Guest account is enabled and echoes status in
# Jamf Computer Extension Attribute format.
#
# Will return Enabled or Disabled.
#
PATH=/usr/bin
@jps3
jps3 / jamf200-s3l13t3-jamf-recon-if-jamf-admin-installed.sh
Last active December 16, 2020 19:17
Jamf 200 - Section 3 - Lesson 13 - Task 3 - Script
#!/bin/bash
#
# Uses Spotlight to identify whether an Application Jamf Admin.app is installed
# (does not assume in /Applications/Jamf Pro/).
# If detected a Jamf inventory update is kicked off.
#
#
PATH=/usr/bin