Skip to content

Instantly share code, notes, and snippets.

Avatar
:octocat:
You are in a maze of twisty little passages, all alike.

Chris Schmich schmich

:octocat:
You are in a maze of twisty little passages, all alike.
View GitHub Profile
@schmich
schmich / workflow.md
Created Aug 11, 2019
Multi-machine feature branch git workflow
View workflow.md

Machine 1

Create a feature branch and sync it to origin.

git checkout -b person/feature-branch
git push -u

Machine 2

@schmich
schmich / notification.js
Created Sep 20, 2018
Cookie clicker audio notification
View notification.js
(new MutationObserver(e => {
if (e && e[0] && e[0].addedNodes && e[0].addedNodes.length > 0) {
if (!window.cookieSound) {
window.cookieSound = new Audio();
window.cookieSound.src = 'https://github.com/schmich/marinara/raw/master/src/audio/f62b45bc.mp3';
}
window.cookieSound.play();
}
})).observe(document.getElementById('shimmers'), { childList: true });
@schmich
schmich / vue.html
Last active Jun 28, 2018
Vue quick prototyping template
View vue.html
<!DOCTYPE html>
<html>
<head>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<style>
</style>
</head>
<body>
<div id="app">
</div>
@schmich
schmich / description.md
Last active Mar 21, 2018
Flexbox vertical centering with top overflow limit
View description.md

Layout

  • Vertically-centered flexbox layout
  • Absolutely-positioned fullscreen container (top/left/right/bottom: 0)
  • On content overflow, content is contained at the top and scrolls to the bottom
  • The crux of the layout:
    • .container { justify-content: space-between; } and .container .content { margin: auto 0; }
    • This allows the content to be centered in the flexbox container while not otherwise overflowing the top
  • The content is positioned just above center with .container .content { padding-bottom: 100px; }
@schmich
schmich / pwned-interactive.rb
Last active Mar 12, 2019
Check if a password has been pwned with the Pwned Passwords V2 API
View pwned-interactive.rb
# 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 / virtualbox.md
Last active Sep 26, 2018
VirtualBox/CentOS setup
View virtualbox.md

Setup host-only networking

This creates a dedicated network between the host and guest, allowing you to SSH and use other network services without the need of an external router.

  • In VirtualBox, edit VM settings and add a second host-only network adapter
  • Log into the guest VM
  • Run ifconfig, note the new adapter's interface name (like enp0s8)
  • Run nmtui
    • Edit a connection > Add > Ethernet
    • Profile name: Host-only Adapter
@schmich
schmich / ducky.md
Last active Aug 8, 2020
Programming media keys on the Ducky One 2 Skyline
View ducky.md

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 / shrink.md
Last active Jan 17, 2018
Shrink VM drive: VMWare Workstation & CentOS
View shrink.md

Guest OS:

xfs_fsr # Defrag.
cat /dev/zero | pv | cat > /zerofile # Write zeroes until space runs out.
sync && shutdown now # Flush and reboot.
rm /zerofile && sync && shutdown now # Remove file, flush, and shutdown.

Host OS:

@schmich
schmich / hosts
Last active Aug 12, 2017
Adblock hosts
View hosts
0.0.0.0 px.moatads.com
0.0.0.0 moatads.com
0.0.0.0 functionalclam.com
@schmich
schmich / npm-prerelease.md
Last active Jul 2, 2020
Publish a prerelease package to NPM
View npm-prerelease.md
  • 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
You can’t perform that action at this time.