Skip to content

Instantly share code, notes, and snippets.

View evanjs's full-sized avatar

Evan Stoll evanjs

View GitHub Profile
total_bugs = $$('td#bz_show_bug_column_1.bz_show_bug_column > table > tbody > tr:nth-child(21) > td > a')
closed_bugs = $$('td#bz_show_bug_column_1.bz_show_bug_column > table > tbody > tr:nth-child(21) > td > a[class*="bz_closed"]')
remaining_bugs = total_bugs.length - closed_bugs.length
console.log(`Total bugs: ${total_bugs.length}\nClosed: ${closed_bugs.length}\nRemaining: ${remaining_bugs}`)
@evanjs
evanjs / gdepends
Created March 29, 2018 15:47
Retrieve unique list of files installed by one or more Gentoo packages
#!/usr/bin/env sh
# returns a unique list of directories used by the provided packages
if [[ -z "$1" ]]; then echo "Please provide at least one package name to query"; exit 1; fi
excludes="doc/
man/
themes/
locale/
@evanjs
evanjs / rbg
Last active May 2, 2018 01:51
Query images in $wallpapers and select a random image for each connected display.
#!/bin/bash
# sets a random background image with a resolution
# that matches each connected display
# Query connected displays
echo "Attempting to randomize wallpapers ..."
wallpapers="/usr/share/wallpapers"
# get a list of connected displays and their respective resolutions
displays=$(xrandr --prop | egrep '\sconnected' | awk '{print $1" " $3}' | cut -d '+' -f-1 )

Keybase proof

I hereby claim:

  • I am evanjs on github.
  • I am evanjs (https://keybase.io/evanjs) on keybase.
  • I have a public key whose fingerprint is 1069 1D56 8B53 2E76 7207 669B 42DE 8B2A A2D4 9DEA

To claim this, I am signing this object:

@evanjs
evanjs / postman-7.6.0
Created September 5, 2019 01:59
build output for postman-7.6.0
copying path '/nix/store/k0yyx362pj2vzdqsz4vg28ajqqixb35r-mirrors-list' from 'https://cache.nixos.org'...
copying path '/nix/store/50yg4m5g8hhyk5hsgyn9f5ls6fap5lzi-nghttp2-1.39.1' from 'https://cache.nixos.org'...
copying path '/nix/store/0acqnzib0xlk02f6qy5mnbd8zgjwh3i7-stdenv-linux' from 'https://cache.nixos.org'...
copying path '/nix/store/skr27lqknr3cl9zh6wqw2cpzbzjzwvz1-libssh2-1.9.0-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/1ms6b60c9vljfi00msx499g65ac8xrmd-nghttp2-1.39.1-bin' from 'https://cache.nixos.org'...
copying path '/nix/store/plmxkhhi0c7r6vjx8571dv5g9i3c3zyy-nghttp2-1.39.1-dev' from 'https://cache.nixos.org'...
copying path '/nix/store/1cgqrfsm6lww013p2xwxr9mga3j2wmw1-curl-7.65.3-dev' from 'https://cache.nixos.org'...
building '/nix/store/hqcyjv1bwkn7vgf5494fbdi80cvrhr0q-source.drv'...
trying https://github.com/mozilla/nixpkgs-mozilla/archive/ac8e9d7bbda8fb5e45cae20c5b7e44c52da3ac0c.tar.gz
@evanjs
evanjs / raz_off.py
Last active March 10, 2020 18:23
Disable LEDs for all connected Razer devices using openrazer
#! /usr/bin/env nix-shell
#! nix-shell -p "python37.withPackages(ps: with ps; [ openrazer ])" -p openrazer-daemon -i python3
from openrazer.client import DeviceManager
from openrazer.client import constants as razer_constants
device_manager = DeviceManager()
device_manager.sync_effects = False
print(f"Found {len(device_manager.devices)} devices")
@evanjs
evanjs / nix build with PR head
Last active May 17, 2020 19:33
use HEAD of PR for nixpkgs and run nix build
PR="${1-77714}"
PACKAGE="${2-pillow}"
nix build -I nixpkgs="https://github.com/nixos/nixpkgs/tarball/$(curl https://api.github.com/repos/nixos/nixpkgs/pulls/$PR/commits | jq -r '.[-1]'.sha)" nixpkgs.$PACKAGE
@evanjs
evanjs / configuration.nix
Last active June 21, 2020 20:22
nixpkgs terraria module - add home config
{ config, lib, pkgs, ... }:
{
services.sshd.enable = true;
services.terraria = {
enable = true;
home = "/srv/terraria";
};
nixpkgs.config.allowUnfree = true;
networking.firewall.allowedTCPPorts = [ 80 ];
@evanjs
evanjs / patch-appliance-esxi.nix
Last active June 4, 2020 17:40
Generate ESXi-compatible virtual appliance
pkgs.runCommand "fix-appliance-esxi" {}
''
mkdir $out
mkdir ova
pushd ova
echo "Tar command: tar -xvf ${vboxImage}/*.ova"
tar -xvf ${vboxImage}/*.ova
ovf=$(ls -1 *.ovf)
{ format ? "virtualbox"
, configuration ? ./configuration.nix
, ...
}:
let
sources = import (nix/sources.nix) {};
pkgs = import (sources.nixpkgs) {};
nixos-generators = import (pkgs.fetchFromGitHub {
owner = "evanjs";
repo = "nixos-generators";