Skip to content

Instantly share code, notes, and snippets.

View rosshadden's full-sized avatar

Ross Hadden rosshadden

View GitHub Profile
#!/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"
@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
@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"

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 / ES6-class-methods.js
Last active May 28, 2018 03:58
Dilemma in trying to obtain method list of child class from the parent constructor.
// Let's call this fileA.js.
class Controller {
constructor() {
// This is the only way I can figure out how to do what I need, but it feels shitty.
var routes = [];
for (var route in this) {
if (typeof this[route] === "function") {
routes.push(route);
}
}
@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 = []) {
## -------------------------------------------------------------------------------------------------------
## 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: This is valid JS:
var foobar = {
foo: function bar() {
// pass
}
};
// B: This is valid ES6
let foobar = {
foo() {