Skip to content

Instantly share code, notes, and snippets.

View rosshadden's full-sized avatar

Ross Hadden rosshadden

View GitHub Profile
@rosshadden
rosshadden / aws-toucher
Last active December 19, 2019 14:50
aws-toucher
#!/usr/bin/env bash
main() {
local profile="$1"
local bucket="$2"
shift; shift
local files=( "$@" )
if [ ! "$files" ]; then
files="$(aws --profile "$profile" s3 ls --human-readable "s3://$bucket" | fzf -m --preview= | awk '{ print $5 }')"
@rosshadden
rosshadden / Dockerfile
Last active October 10, 2019 01:43
PDF => ZPL
FROM node:latest
RUN apt update && apt install -yq ghostscript python3-pip
RUN pip3 install zplgrf==1.4.2
COPY ./src /app
RUN chmod +x /app/convert

Keybase proof

I hereby claim:

  • I am rosshadden on github.
  • I am rosshadden (https://keybase.io/rosshadden) on keybase.
  • I have a public key whose fingerprint is 99D8 22B5 68CF 7238 2BB7 0A96 6B19 DFDE 659E C841

To claim this, I am signing this object:

@rosshadden
rosshadden / puppet.js
Created September 3, 2017 16:25
puppeteer head/less differences
#!/usr/bin/env node
const puppeteer = require('puppeteer');
const timeout = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
const params = {
url: 'https://vendorcentral.amazon.com/gp/vendor/sign-in',
user: 'foo@bar.baz',
password: 'lol',
function gcd (x, y) {
let _gcd = (a, b) => (b === 0 ? a : _gcd(b, a % b));
return _gcd(Math.abs(x), Math.abs(y));
}
function lcm (x, y) {
return (x === 0 || y === 0) ? 0 : Math.abs(Math.floor(x / gcd(x, y)) * y);
}
function minQuantity(values = []) {
@rosshadden
rosshadden / mon.sh
Created May 12, 2017 14:18
Mixed non/HiDPI monitors in X
#!/usr/bin/env bash
numDisplays=$(xrandr --current | grep '\bconnected' | wc -l)
outputs="--output eDP1 --primary --mode 2880x1620 --pos 2880x0 --dpi 96 --scale 1x1"
xrandr --output HDMI1 --off
xrandr --output DP2 --off
if xrandr | grep "HDMI1 connected"; then
outputs+=" --output HDMI1 --auto --mode 1920x1080 --pos 0x0 --right-of eDP1 --scale 1.5x1.5"
#!/usr/bin/env bash
numDisplays=$(xrandr --current | grep '\bconnected' | wc -l)
outputs="--output eDP1 --primary --mode 2880x1620 --pos 2880x0 --dpi 96 --scale 1x1"
xrandr --output HDMI1 --off
xrandr --output DP2 --off
if xrandr | grep "HDMI1 connected"; then
outputs+=" --output HDMI1 --auto --mode 1920x1080 --pos 0x0 --right-of eDP1 --scale 1.5x1.5"
## -------------------------------------------------------------------------------------------------------
## Copyright (C) Microsoft. All rights reserved.
## Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
## -------------------------------------------------------------------------------------------------------
## / \mainpage Chakra Hosting API Reference
## /
## / Chakra is Microsoft's JavaScript engine. It is an integral part of Internet Explorer but can
## / also be hosted independently by other applications. This reference describes the APIs available
## / to applications to host Chakra.
## /
--- a/PKGBUILD 2015-04-14 16:39:10.426806715 -0400
+++ b/PKGBUILD 2015-04-14 16:39:21.794203724 -0400
@@ -14,6 +14,14 @@ backup=('etc/asd.conf')
install=asd.install
sha256sums=('b3b4af38a2fc854e80101e931d92207a5e6f1e1640d1c114f8924cdfd937650f')
+prepare() {
+ cd "$pkgname-$pkgver"
+
+ # modify script to exclude *.swp files
@rosshadden
rosshadden / purple.py
Last active August 29, 2015 14:15
Send IMs with Pidgin/Finch's DBUS interface
#/usr/bin/env python3
import dbus
bus = dbus.SessionBus()
obj = bus.get_object("im.pidgin.purple.PurpleService", "/im/pidgin/purple/PurpleObject")
purple = dbus.Interface(obj, "im.pidgin.purple.PurpleInterface")