Skip to content

Instantly share code, notes, and snippets.

@apfelchips
apfelchips / ngrok.service
Last active August 2, 2021 14:38
autostart ngrok with systemd - put binary and ngrok.yml into /opt/ngrok/
# put me in: /etc/systemd/system/
# ngrok binary: https://ngrok.com/download
# sudo chmod +x /opt/ngrok/ngrok
[Unit]
Description=ngrok
After=network.target
[Service]
ExecStart=/opt/ngrok/ngrok start --all --config /opt/ngrok/ngrok.yml
ExecReload=/bin/kill -HUP $MAINPID
@apfelchips
apfelchips / ghidra_processor_docs_downloader.py
Last active October 16, 2023 15:06 — forked from ckuethe/ghidra_processor_docs_downloader.py
Ghidra Processor Documentation Downloader
#!/usr/bin/env python3
# vim: tabstop=4:softtabstop=4:shiftwidth=4:expandtab:
import os
import sys
import requests
docs = {
'68000': {
'M68000PRM.pdf': 'https://www.nxp.com/files-static/archives/doc/ref_manual/M68000PRM.pdf',
@apfelchips
apfelchips / nginx.conf
Last active August 17, 2021 08:36
generic nginx.conf template
# src: https://git.io/J3aWK
# doc: https://docs.nginx.com/nginx/admin-guide/web-server/serving-static-content/
# example: https://www.nginx.com/resources/wiki/start/topics/examples/full/#nginx-conf
# example: https://gist.github.com/terrywang/9612069
user user staff; ## Default: nobody
worker_processes auto; ## Default: 1
#error_log logs/error.log;
#error_log logs/error.log notice;
@apfelchips
apfelchips / sync-down-ftp.ps1
Last active May 11, 2021 08:10
lftp script, but it's actually crossplatform
#!/usr/bin/env pwsh -noLogo -noProfile
# get lftp for windows here: https://nwgat.ninja/lftp-for-windows/
# doc: https://manpages.debian.org/lftp/lftp.1.en.html
$USER=''
$PASS=''
$REMOTEHOSTNAME=''
$LOCALDIR='./homedir-subfolder'
$REMOTEDIR='/var/www/'
@apfelchips
apfelchips / Profile.ps1
Last active February 16, 2023 20:19
my crossplatform PowerShell Profile
# Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
# src: https://gist.github.com/apfelchips/62a71500a0f044477698da71634ab87b
# New-Item $(Split-Path "$($PROFILE.CurrentUserCurrentHost)") -ItemType Directory -ea 0; Invoke-WebRequest -Uri "https://git.io/JYZTu" -OutFile "$($PROFILE.CurrentUserCurrentHost)"
# ref: https://devblogs.microsoft.com/powershell/optimizing-your-profile/#measure-script
# ref: Powershell $? https://stackoverflow.com/a/55362991
# ref: Write-* https://stackoverflow.com/a/38527767
# Write-Host wrapper for Write-Information -InformationAction Continue
@apfelchips
apfelchips / macOS-shortcuts.ahk
Last active April 18, 2024 14:39
First remap modifier keys with sharpkeys; AHK script has to run as Administrator to work on System Windows / Apps running as Administrator; see Watchdog ScheduledTask below, when you do this make sure to remove the inherited file permissions from C:/tools and only allow administrators write access.
;#NoTrayIcon
TraySetIcon("accessibilitycpl.dll","6") ; Keyboard Icon
;#Persistent https://www.autohotkey.com/docs/commands/_Persistent.htm
; legacy? SendMode("Input") ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir(A_ScriptDir) ; Ensures a consistent starting directory.
#SingleInstance force
;#InstallKeybdHook ; see: https://www.autohotkey.com/docs/v1/lib/_HotkeyModifierTimeout.htm
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8">
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Sidebar HTML Template</title>
<style type="text/css">
#nav {
@apfelchips
apfelchips / ~ 🥖bin🥖init_osx.sh
Last active February 10, 2024 16:25
initialize macOS.
#!/bin/bash
# https://www.defaults-write.com
# https://github.com/joeyhoer/starter/tree/master/system
# https://github.com/atweiden/macfiles/blob/master/macos.sh
# https://gist.github.com/ryanpcmcquen/b2e608311f286a4ab3e1
# https://github.com/herrbischoff/awesome-macos-command-line
#
# discover filesystem changes: sudo filemon -c
#
@apfelchips
apfelchips / Brewfile.rb
Last active August 16, 2023 15:34
homebrew bundle file ~/Brewfile
# src: https://gist.github.com/apfelchips/2c42af4b1c10318e5f4d89826324723b
# doc: https://github.com/Homebrew/homebrew-bundle
# to install execute: brew bundle
# to check validity: brew bundle check
# examples:
# https://github.com/ahmetb/dotfiles/blob/master/.Brewfile
# https://github.com/SHxKM/macos-setup/blob/master/Brewfile
@apfelchips
apfelchips / choco_install.ps1
Last active April 18, 2024 18:01
chocolatey package install script
# allow running: Set-ExecutionPolicy Bypass -Scope Process -Force
# src: https://gist.github.com/apfelchips/792f7708d0adff7785004e9855794bc0
# goal: install all basic tools / pin software with working autoupdate mechanism / specialized stuff is commented out
# misc: Windows Store .appx downloader https://store.rg-adguard.net/
# Check Permissions
if ( -Not( (New-Object Security.Principal.WindowsPrincipal $([Security.Principal.WindowsIdentity]::GetCurrent())).IsInRole([Security.Principal.WindowsBuiltinRole]::Administrator)) ){
Write-Error -Message "Script needs Administrator permissions"