Skip to content

Instantly share code, notes, and snippets.

View realdimas's full-sized avatar

Dima Scherbakov realdimas

View GitHub Profile
@ssokolow
ssokolow / partial_shell_parser.py
Last active January 8, 2022 17:45
Python code to extract variables from a shell script
import shlex
def lex_shellscript(script_path, statement_cb):
"""Given a file-like object, use a POSIX-mode shlex.shlex object to split
it into statements and call the given statement processor to convert
statements into dicts.
"""
fields = {}
with open(script_path, 'r') as fobj:
@joeblau
joeblau / OSX Secure Disk Wipe.md
Last active June 12, 2023 07:37
Securely erase an external disk using dd on OSX

Securely erase an external disk using dd on OSX

  1. Plug in your SD card, HDD, or other block device and then use the following command to see which /dev/diskN node it's located on:
diskutil list
  1. Unmount the disk where “N� is the number of the disk taken from the above command:
@kennwhite
kennwhite / vpn_psk_bingo.md
Last active February 24, 2024 12:19
Most VPN Services are Terrible

Most VPN Services are Terrible

Short version: I strongly do not recommend using any of these providers. You are, of course, free to use whatever you like. My TL;DR advice: Roll your own and use Algo or Streisand. For messaging & voice, use Signal. For increased anonymity, use Tor for desktop (though recognize that doing so may actually put you at greater risk), and Onion Browser for mobile.

This mini-rant came on the heels of an interesting twitter discussion: https://twitter.com/kennwhite/status/591074055018582016

//
// This Groovy snippet is used for Jenkins Job DSL groovy script,
// when ...
// 1. enable Jenkins Global Security
// 2. use pipelineJob
// 3. want to approve pipeline cps automatically
//
import jenkins.model.Jenkins
def doTheThing(Closure doMe) {
try {
return doMe()
} catch (org.jenkinsci.plugins.workflow.steps.FlowInterruptedException fie) {
// this ambiguous condition means a user probably aborted
if (fie.causes.size() == 0) {
throw new UserInterruptedException(fie)
} else {
throw fie
}
@unnamed777
unnamed777 / Hammerspoon for karabiner
Last active September 26, 2017 05:35
Hammerspoon: swap karabiner configs depending on language
Hammerspoon for karabiner

Disable Device Enrollment Notification on Mac.md

Restart the Mac in Recovery Mode by holding Comment-R during restart

Open Terminal in the recovery screen and type

csrutil disable
@tallclair
tallclair / restricted-psp.yaml
Last active April 16, 2024 07:46
Restricted PodSecurityPolicy
apiVersion: extensions/v1beta1
kind: PodSecurityPolicy
metadata:
name: restricted
annotations:
seccomp.security.alpha.kubernetes.io/allowedProfileNames: 'docker/default'
apparmor.security.beta.kubernetes.io/allowedProfileNames: 'runtime/default'
seccomp.security.alpha.kubernetes.io/defaultProfileName: 'docker/default'
apparmor.security.beta.kubernetes.io/defaultProfileName: 'runtime/default'
spec:
@bobrik
bobrik / README.md
Last active May 7, 2024 12:19
CFS hiccups
@a7ul
a7ul / jamf.md
Last active March 29, 2024 09:47
removing all restrictions on jamf managed macos device - Provided you have root access.

REMOVE JAMF RESTRICTIONS ON MAC

REMOVE ONLY RESTRICTIONS

sudo jamf removeMDMProfile removes all restrictions

sudo jamf manage brings back all restrictions and profiles

REMOVE ALL RESTRICTIONS AND DISABLE JAMF BINARIES WHILE KEEPING YOUR ACCESS TO VPN AND OTHER SERVICES

sudo jamf removeMDMProfile removes all restrictions