Skip to content

Instantly share code, notes, and snippets.

View hinchley's full-sized avatar
🎯
Focusing

Peter Hinchley hinchley

🎯
Focusing
View GitHub Profile
@hinchley
hinchley / GhosttyShortcuts.md
Created March 8, 2025 00:16
Ghostty Shortcuts

Ghostty Shortcuts

Shortcut Purpose
Shift + Ctrl + N New window
Ctrl + Enter Toggle full screen
Shift + Ctrl + T New tab
Ctrl + Tab Next tab
Shift + Ctrl + Tab Previous tab
Shift + Ctrl + W Close split/tab/window*
@hinchley
hinchley / ZshShortcuts.md
Created March 7, 2025 22:54
Zsh Shortcuts

Zsh Shortcuts

Shortcut Purpose
Alt + B Move to start of current/previous word
Alt + F Move to start of next word
Ctrl + A Move to start of current line
Ctrl + E Move to end of current line
Alt + H Open man page for current command
Alt + Del Delete to start of current/previous word
@hinchley
hinchley / FirefoxShortcuts.md
Created March 4, 2025 23:16
Firefox Shortcuts

Firefox Shortcuts

Shortcut Purpose
Ctrl + ] Forward in nav history
Ctrl + [ Backward in nav history
Ctrl + Home Home page
Ctrl + R Refresh page
Shift + Ctrl + R Refresh page without cache
Space Move down page
@hinchley
hinchley / tweets.php
Created March 17, 2017 23:21
Archive your twitter timeline into a sqlite database using PHP.
<?php
# define api keys.
define('CONSUMER_KEY', 'XXX');
define('CONSUMER_SECRET', 'XXX');
define('OAUTH_TOKEN', 'XXX');
define('OAUTH_SECRET', 'XXX');
define('USER_TIMELINE', 'https://api.twitter.com/1.1/statuses/user_timeline.json');
# tweets to retrieve per request.
@hinchley
hinchley / UserWritableLocations.ps1
Created September 12, 2016 09:35
A PowerShell script for identifying user-writable folders. Usage is discussed in the following article: http://hinchley.net/2016/06/13/an-approach-for-managing-microsoft-applocker-policies/
# Paths that we've already excluded via AppLocker.
$exclusions = @()
# Paths to process.
$paths = @(
"C:\Windows"
)
# Setup log.
$log = "$PSScriptRoot\UserWritableLocations.log"
Add-Type -TypeDefinition @"
using System;
using System.IO;
using System.Text;
using System.Drawing;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using System.Linq;
using Microsoft.Win32;
@hinchley
hinchley / AppLocker.ps1
Created September 12, 2016 09:39
A PowerShell script for generating AppLocker policies. Usage is discussed in the following article: http://hinchley.net/2016/06/13/an-approach-for-managing-microsoft-applocker-policies/
<# examples:
# generate a baseline policy.
powershell.exe -file applocker.ps1 -baseline -output c:\policies\baseline.xml
# generate an application-specific policy.
powershell.exe -file applocker.ps1 -application -in c:\policies\baseline.xml -out c:\policies\application.xml
# generate an adhoc policy.
powershell.exe -file applocker.ps1 -adhoc -in c:\path -filter *.* -out c:\policies\adhoc.xml
@hinchley
hinchley / Ciphers.php
Created January 18, 2015 04:55
Caesar Cipher and Vigenère Cipher in PHP
<?php
class Map {
/* $table = [
* 'encrypt' =>
* ['A' => 'A', 'B' => 'B', ...],
* ['A' => 'B', 'B' => 'C', ...],
* ...
* 'decrypt' =>
* ['A' => 'A', 'B' => 'B', ...],
@hinchley
hinchley / DisableBorder.ps1
Created January 18, 2015 09:03
Disable Microsoft Office 2013 Border Shadow with PowerShell
Add-Type -TypeDefinition @"
using System;
using System.Runtime.InteropServices;
namespace Utilities {
public static class Display {
private const uint WM_USER = 0x0400;
private const uint WM_MSO = WM_USER + 0x0900;
private const uint WM_MSO_WPARAM_OMFRAMEENABLESHADOW = 0x0075;
@hinchley
hinchley / index.js
Created February 23, 2020 04:19
HTTP requests in Node.js
const fetch = (url, cb, options = {}) => {
const { protocol } = new URL(url);
const http = protocol === 'https:'
? require('https')
: require('http');
options = { headers: { 'User-Agent': 'node.js' }, ...options };
const error = e => console.log(e.message);