Skip to content

Instantly share code, notes, and snippets.

View HarlemSquirrel's full-sized avatar

Kevin McCormack HarlemSquirrel

View GitHub Profile
@HarlemSquirrel
HarlemSquirrel / bundler.rb
Created November 27, 2017 15:41
Warbler 2.0.4 and Bundler 1.16.0 missing bundler.gemspec hack for lib/warbler/traits/bundler.rb
#--
# Copyright (c) 2010-2012 Engine Yard, Inc.
# Copyright (c) 2007-2009 Sun Microsystems, Inc.
# This source code is available under the MIT license.
# See the file LICENSE.txt for details.
#++
module Warbler
module Traits
# The Bundler trait uses Bundler to determine gem dependencies to
@HarlemSquirrel
HarlemSquirrel / site_status.sh
Created February 15, 2018 20:29
Montior the status and duration of a endpoint with a GET request
#!/bin/bash
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # No Color
if [ $# -eq 0 ]; then
printf "Usage:\n"
printf " $0 http://example.com [interval]\n"
exit 1
@HarlemSquirrel
HarlemSquirrel / build_nitrogen_ubuntu_1604.sh
Last active May 15, 2018 02:10
Build Nitrogen on Ubuntu 16.04
# Building Nitrogen on Ubuntu 16.04
# https://github.com/l3ib/nitrogen
# Install dependencies
sudo apt-get install autoconf autopoint libgtk2.0-dev libgtkmm-2.4-dev libglib2.0-dev
# Download
cd ~/Downloads
wget https://github.com/l3ib/nitrogen/releases/download/1.6.1/nitrogen-1.6.1.tar.gz
@HarlemSquirrel
HarlemSquirrel / PKGBUILD
Created September 15, 2018 06:01
ArchLinux PKGBUILD for rocm-opencl
# Maintainer: Kevin McCormack <harlemsquirrel@gmail.com
pkgname=rocm-opencl
pkgver=1.2.0
pkgverdate=2018090737
pkgrel=2
_debfile=rocm-opencl_${pkgver}-${pkgverdate}_amd64.deb
pkgdesc="ROCm Platform Runtime: Closed source opencl"
arch=('x86_64')
url="https://github.com/RadeonOpenCompute/ROCm"
license=('EULA')
@HarlemSquirrel
HarlemSquirrel / type_on_wayland.py
Created February 5, 2020 00:20
Sample test sending keys on Wayland from string to emulate typing.
import sys
import time
# https://pypi.org/project/evdev/
import evdev
string = 'We are typing this 1!'
with evdev.UInput() as ui:
escape = False
@HarlemSquirrel
HarlemSquirrel / thread_concurrency_limit_demo.rb
Created April 20, 2020 01:05
Ruby thread concurrency limit demo
# The total number of threads we want to all to run at the same time
concurrent_thread_limit = 4
# The total number of threads to run for this demo
total_thread_count = 13
@threads = []
##
# Print the status of all threads to the console
#
@HarlemSquirrel
HarlemSquirrel / dn_issue_demo.rb
Created August 5, 2020 02:55
A demonstration of the DN and base issue detailed in activeldap/activeldap#185
##
# A demonstration of the DN and base issue detailed in
# https://github.com/activeldap/activeldap/issues/185
# Due to how requires are handled, we need to do some directory
# trickery to require our local copy of the source code.
base_dir = File.expand_path(File.dirname(__FILE__))
top_dir = File.expand_path(File.join(base_dir, ".."))
lib_dir = File.join(top_dir, "lib")
$LOAD_PATH.unshift(File.join __dir__, 'lib')
@HarlemSquirrel
HarlemSquirrel / thread_issue_demo.rb
Last active September 23, 2020 19:17
Reproduce ActiveLdap thread-safe issue
##
# This can reproduce https://github.com/activeldap/activeldap/issues/186
#
# Uses OpenLDAP Docker container
# docker run -p 1389:389 --name activeldap-test --detach osixia/openldap
#
require 'active_ldap'
class User < ActiveLdap::Base
@HarlemSquirrel
HarlemSquirrel / diff_filter.sh
Created December 5, 2020 19:36
Filter a command like rubocop to look for issues only on modified lines.
#!/bin/bash
##
# Filter a command like rubocop to look for issues only on modified lines.
#
# Inspired by http://takemikami.com/2018/01/30/RubocopPullRequestCI.html
#
BASE_REMOTE=origin
BASE_BRANCH=master
@HarlemSquirrel
HarlemSquirrel / install_hydrapaper_u18.04.sh
Last active February 2, 2021 19:26
Install HydraPaper on Ubuntu 18.04
#!/bin/bash
# Install HydraPaper on Ubuntu 18.04
# No super user access required if flatpak is installed
# HarlemSquirrel.github.io
# Install flatpak
sudo apt install -y flatpak gnome-software-plugin-flatpak
# Add flathub repo for the current user
flatpak --user remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo