Skip to content

Instantly share code, notes, and snippets.

View schmich's full-sized avatar
:octocat:
May all beings be at ease

Chris Schmich schmich

:octocat:
May all beings be at ease
View GitHub Profile
@schmich
schmich / pwned-interactive.rb
Last active October 15, 2021 14:44
Check if a password has been pwned with the Pwned Passwords V2 API
# Check a single password interactively.
# Usage: ruby pwned-interactive.rb
require 'io/console'
require 'open-uri'
require 'digest'
puts "The 5-character prefix of the password's SHA-1 hash will be sent."
puts "For details, see https://www.troyhunt.com/ive-just-launched-pwned-passwords-version-2/"
print 'Password (hidden): '
@schmich
schmich / ducky.md
Last active July 10, 2024 10:25
Programming media keys on the Ducky One 2 Skyline

Programming Media Keys on the Ducky One 2 Skyline

To use media keys on the Ducky One 2 Skyline, you must record a macro to bind the media function to a hotkey combination, i.e. Fn plus some key.

Example

Important: In the instructions below, "Press X+Y+Z" means press and hold key X, press and hold key Y, press and hold key Z in that order, and then release all three.

As an example, to bind Fn+PgUp to the play/pause media function:

@schmich
schmich / npm-prerelease.md
Last active June 26, 2024 13:20
Publish a prerelease package to NPM
  • Update package.json, set version to a prerelease version, e.g. 2.0.0-rc1, 3.1.5-rc4, ...
  • Run npm pack to create package
  • Run npm publish <package>.tgz --tag next to publish the package under the next tag
  • Run npm install --save package@next to install prerelease package
@schmich
schmich / termbin-encrypted-data.md
Last active April 19, 2024 04:47
Sharing encrypted data via termbin.com with only netcat and OpenSSL

Single file

Source

  • cat /foo/bar/file.txt | openssl enc -aes-256-cbc -base64 | nc termbin.com 9999
  • Enter password twice (quickly), note termbin.com URL

Destination

  • curl -s http://termbin.com/{id} | openssl enc -aes-256-cbc -base64 -d &gt; file.txt
@schmich
schmich / config.bat
Last active July 5, 2023 03:36
Forward external connections to Docker on Windows
REM In admin prompt
REM Ensure web server/application is listening on all interfaces (0.0.0.0)
netsh interface portproxy add v4tov4 listenaddress=0.0.0.0 listenport=80 connectaddress=10.0.75.2 connectport=80
netsh advfirewall firewall add rule name="App" dir=in action=allow protocol=TCP localport=80 remoteport=80
netsh interface portproxy show v4tov4
netsh advfirewall firewall show rule "App"
netsh interface portproxy delete v4tov4 listenaddress=0.0.0.0 listenport=80
netsh advfirewall firewall del rule name="App"
@schmich
schmich / multi-account-gmail.md
Last active May 9, 2016 21:31
Multi-account Gmail

Multi-account Gmail

Google Apps note

  • If your secondary account is hosted on Google Apps, you might need to allow less secure apps to enable sending and forwarding
  • See details here

Primary account

  • Settings > Accounts and Import > Send mail as > Add another email address you own
@schmich
schmich / signing-git-tags-on-windows.md
Last active May 13, 2016 03:00
Signing git tags on Windows

Signing git tags on Windows

  • Download and install Gpg4win Vanilla (command-line only GPG tools)
  • Create or import an existing key in Windows
    • Create a new key
      • ...
    • Import an existing key
      • On origin system, gpg -a --export-secret-keys you@email.com > secret.key
      • Transfer secret.key to Windows, delete it from origin system
  • On Windows, run gpg --allow-secret-key-import --import secret.key
@schmich
schmich / dev-setup.sh
Last active March 11, 2016 09:59
Multi-user git webserver deployment
sudo echo 192.168.1.42 webserver >> /etc/hosts
sudo cat >> ~/.ssh/config <<EOF
Host webserver 192.168.1.42
User user1
Hostname webserver
IdentityFile ~/.ssh/id_rsa
EOF
cat ~/.ssh/id_rsa.pub | (ssh user@webserver "mkdir -p .ssh && cat >> ~/.ssh/authorized_keys")
git init project
cd project
@schmich
schmich / dw.snippet
Last active July 8, 2022 11:34
Visual Studio snippet to insert Debug.WriteLine with dw
<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<CodeSnippet Format="1.0.0">
<Header>
<Title>dw</Title>
<Shortcut>dw</Shortcut>
<Description>Code snippet for Debug.WriteLine</Description>
<Author>Chris Schmich</Author>
<SnippetTypes>
<SnippetType>Expansion</SnippetType>
@schmich
schmich / psiupuxa.rb
Last active February 8, 2022 14:55
Download desktop-resolution wallpapers from http://psiupuxa.com/
# Download desktop-resolution wallpapers from http://psiupuxa.com/
# into the current directory.
require 'nokogiri'
require 'open-uri'
require 'openssl'
require 'uri'
# Disable SSL verification. Ruby SSL cert bundle isn't installed on Windows by default.
OpenSSL::SSL::VERIFY_PEER = OpenSSL::SSL::VERIFY_NONE