Skip to content

Instantly share code, notes, and snippets.

View nstickney's full-sized avatar

Stick nstickney

View GitHub Profile
@nstickney
nstickney / echo-in-console-instruction-count.md
Last active April 28, 2020 15:21 — forked from zloster/echo-in-console-instruction-count.md
How much work the poor CPU needs to do when we echo 4-characters string in the Linux console?

And the answer is:

310,261 instructions

--@--:~$ uname -a
Linux 5.6.7-arch1-1 #1 SMP PREEMPT Thu, 23 Apr 2020 09:13:56 +0000 x86_64 GNU/Linux
--@--:~$ sudo perf stat echo test
test
@nstickney
nstickney / Makefile
Last active January 5, 2020 16:36 — forked from kristopherjohnson/Makefile
Makefile that uses Pandoc to generate HTML, PDF, DOCX, etc. from Markdown source files
# Makefile
#
# Credits: https://gist.github.com/kristopherjohnson/7466917
#
# Converts Markdown to other formats using Pandoc (https://pandoc.org/)
#
# Convert a single Markdown file to a specific format:
# $ make <filename>.<format_suffix>
#
# Convert all Markdown files to a specific format:
@nstickney
nstickney / sway-alt-tab.py
Last active January 4, 2020 15:42 — forked from SidharthArya/alttab
Sway Windows Manager Alt Tab behavior
#!/usr/bin/env python
''' Switch between all available windows in Sway '''
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at http://mozilla.org/MPL/2.0/.
__author__ = 'Stick'
__credits__ = ['https://gist.github.com/SidharthArya']
__email__ = 'stick@stma.is'

Keybase proof

I hereby claim:

  • I am nstickney on github.
  • I am nstickney (https://keybase.io/nstickney) on keybase.
  • I have a public key ASBgRJ_5nS70vav2lD5lT68QM8i5OEyd-y0xeG5_XOv9lgo

To claim this, I am signing this object:

@nstickney
nstickney / git_tableflip.bashrc
Created October 3, 2018 01:55
bashrc git tableflip
# https://twitter.com/aran384/status/1046487063489437696
if [ ! -x "$(command -v tableflip)" ]; then
tableflip() {
while true; do
read -r -p "Really throw it all away? [y/N]: " -n 1 yn
printf '\n'
case $yn in
[Yy]* ) git fetch && git reset --hard && git clean -dfx; break;;
[Nn]* ) break;;
"" ) break;;