Skip to content

Instantly share code, notes, and snippets.

View JonathanPorta's full-sized avatar
🎯
Focusing

Jonathan Porta JonathanPorta

🎯
Focusing
View GitHub Profile
@JonathanPorta
JonathanPorta / setpin.sh
Last active January 4, 2021 13:32
Change Yubikey PIN/PUK
#!/bin/bash
set -e # bail on errors
# Make sure your shell history isn't saved
hsback=$HISTFILE
unset HISTFILE
echo "Enter you current PIN - leave blank if default:"
read oldpin
@JonathanPorta
JonathanPorta / gist:001fd6ec328847dca227
Last active August 29, 2015 14:26
Trying to get Windows Update to Download the Windows 10 Upgrade
# This didn't work.
Jonathan Porta@PORTAJ-GAMETOP C:\Users\Jonathan Porta
$ net stop wuauserv
The Windows Update service is stopping.
The Windows Update service was stopped successfully.
Jonathan Porta@PORTAJ-GAMETOP C:\Users\Jonathan Porta
$ rd /s /q C:\Windows\SoftwareDistribution
C:\Windows\SoftwareDistribution\Download\8F36B3~1\BITB8C4.tmp - The operation completed successfully.
@JonathanPorta
JonathanPorta / golang-json-marshall
Created October 5, 2015 17:25 — forked from kendellfab/golang-json-marshall
Handling custom Json marshalling in golang.
type Whatever struct {
someField int
}
func (w Whatever) MarshalJSON() ([]byte, error) {
return json.Marshal(struct{
SomeField int `json:"some_field"`
}{
SomeField: w.someField,
})
@JonathanPorta
JonathanPorta / dd-examples.md
Last active June 1, 2025 15:30
DD Backup, Compress, and Restore

Backup/Image

Make sure the if value is correct! If doing this over SSH then open a TMUX session first... or else...

dd if=/dev/YOUR-DEVICE conv=sync,noerror bs=64K | gzip -c  > /home/portaj/macbook.img.gz

NOTE: You might not want to compress the image. It just means you have to uncompress it later to mount it. If you're planning to access the data soon, or frequently, don't compress it.

Saving a copy of the drive geometry

Save it in the same directory as the compressed image so later on if you decide you want to mount or extract data from the image you can see the partition structure without having to decompress the whole image. There might be some other ways to mount a compressed image.

<style type='text/css'>
@font-face{
font-family:'Open Sans';
src:url(data:application/font-woff2;charset=utf-8;base64,d09GMgABAAAAAEUIABMAAAAApSQAAESaAAEZmgAAAAAAAAAAAAAAAAAAAAAAAAAAP0ZGVE0cGiAbIBx4BmAAg1oIRgmEZREICoKjPIKBUQE2AiQDhyYLg1YABCAFg3oHhWUMgnw/d2ViZgYbEpEV7EZ4twOUBLUVbzQygo0DEEHjrJGBPA7IpFeQ/f/1gMoYtpN0oOh5SVI0oCbToqZZ+M2jFVuisfhOFaH3m79Y2+5j07rTWm1Tn6geLd3KxqZz8dfaUyknlw9lGIHNIjoj2vBVYF/Bb9BtezsR8dhDF6E84Ax8X4qzusp/ONfPAHcSR6NOeJ7HK//c924yUzslpvAWIlMCu9+IfdpedQag83hWfjbr/Fubz8ySkaanQB2P0jUbwApbxKpLVJ3VdK+ySeNs4iO0JI/ugJ0OwDbFRscidWnkxCllNVZijoFiYyAgYiRYGIUFGIVYhdixtDe3uX/OtS7q73tt2msM8fOMN/4AUBJ0TALbm0QBoI0a+9J94AoQO+zuWGAI8AXAfHPfv5MMcGAgmRDtBV56gL+kXV2d6KkEdJoSHAPA713Dst0Jzfwki80W6JiMO0cALRvV58+e8fd8y/Afzf27j0OT7CQPsES3ROu+MhXCT1nqA///+stXLzNZfjZLxiEyfBjDhBQuyvLse/X8oSpS9ApUqeia9q/wkJA4BLvo5t/H2ovtBBdFk7bNXZSaNGUIvz+weVC1gtEBbfJDp9QCCPi/uSrb0wvEjo3Zt3qdTv1UhxvovUkvznCGsVJdA0lngQ9YKEA56SVidayOHYFbd/KEsMDCyvt5Vc31PYCUPmjpSitbyrBQ0vlSpyxjhsn/fwDUB0DQ5AepI0DKJimfj6R8DgnJd5R0CYtl1UtkpzedU8uk
2016-06-28T07:43:57.225406+00:00 app[worker.1]: During handling of the above exception, another exception occurred:
2016-06-28T07:43:57.225406+00:00 app[worker.1]:
2016-06-28T07:43:57.225407+00:00 app[worker.1]: Traceback (most recent call last):
2016-06-28T07:43:57.225411+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.4/site-packages/rq/worker.py", line 568, in perform_job
2016-06-28T07:43:57.225412+00:00 app[worker.1]: rv = job.perform()
2016-06-28T07:43:57.225413+00:00 app[worker.1]: File "/app/.heroku/python/lib/python3.4/site-packages/rq/job.py", line 495, in perform
2016-06-28T07:43:57.225413+00:00 app[worker.1]: self._result = self.func(*self.args, **self.kwargs)
2016-06-28T07:43:57.225414+00:00 app[worker.1]: File "/app/extractors/yellowstone_property_tax.py", line 15, in execute
2016-06-28T07:43:57.225414+00:00 app[worker.1]: data = {'url': self.url, 'data': self.GET(self.url)}
2016-06-28T07:43:57.225415+00:00 app[worker.1]: File "/app/lib/url_extractor.py", line 7, i
# A reverse ssh tunnel systemd service.
[Unit]
Description=Create an SSH tunnel for the MTNA service
ConditionPathExists=|/usr/bin
After=network.target
[Service]
User=stanparker
Environment="AUTOSSH_DEBUG=True"
Environment="AUTOSSH_GATETIME=0"
// ==UserScript==
// @name New Userscript
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author You
// @match https://admin-kube.dashboard.getpantheon.com/sites/a35db090-b90d-43d2-8417-e5f03f10318d
// @grant none
// ==/UserScript==
@JonathanPorta
JonathanPorta / gist:4655470a99306aab407a7009f244ff97
Last active March 20, 2017 13:31
Add a checkbox to a Twitter user and then see who was checked
// This File: https://gist.github.com/JonathanPorta/4655470a99306aab407a7009f244ff97
// Handles List: https://gist.github.com/JonathanPorta/5278413566e561e1c4bf059aecf99d1d
// Add the checkboxes
var allHandles = [];
$('a.ProfileCard-screennameLink').each(function(i,e){
var $e = $(e);
var handle = $e.text().trim();
$e.before($("<input type='checkbox' style='height: 2.5em; width: 2.5em;' value='"+handle+"'/>"));
allHandles.push(handle);
});
@JonathanPorta
JonathanPorta / Storing_in_a_repo.txt
Last active November 19, 2017 14:09 — forked from jcward/Readme.txt
Generating iOS P12 / certs without Mac OSX Keychain (on linux, windows, etc)
If you like to GPG your certs and store them in your repo:
tar -cf ios_distribution.tar ios_distribution.* *.mobileprovision Apple*
gpg -c ios_distribution.tar
Decrypt and untar using:
gpg --decrypt ios_distribution.tar | tar -x
Here's a .gitignore that ignores everything in the directory (aka, certs and