Skip to content

Instantly share code, notes, and snippets.

View andrew-kennedy's full-sized avatar

Andrew Kennedy andrew-kennedy

View GitHub Profile
@sidneys
sidneys / nvm_node_updater.sh
Last active July 25, 2020 13:54
Node & NPM Global Updater: Updates NodeJS, NPM and all global Packages to 'latest' in one step
#!/bin/bash
# NVM_NODE_UPDATER
# v2.0.0
#
# Makes keeping NVM-managed, global NodeJS installations up-to-date a breeze.
# First, the global NodeJS installation is updated to 'latest'.
# Second, all global NPM packages are migrated, then also updated to 'latest'.
# Requires the Node Version Manager (https://github.com/creationix/nvm).
#
@vitorio
vitorio / osx-libnfc-movable.md
Last active January 16, 2021 08:26
Compiling libnfc natively on OS X for use in any working directory

These instructions compile a native OS X version of libnfc, and adjust its internal paths and those of its dependencies to allow you to use it from any arbitrary working directory, which is normally restricted in versions of OS X with System Integrity Protection.

Assumes OS X with Xcode or Xcode command-line tools, not macports or homebrew

To install Xcode command-line tools in recent versions of OS X, open Terminal, type xcode-select --install and click "Install"

Older versions of OS X may need to manually download disk images of older versions of Xcode and/or the Xcode command-line tools, as various certificates may have expired (e.g. 10.7.4 requires a manual install from the Xcode 4.6.2 command-line tools image)

Download latest pkg-config (tested with 0.29.1) from https://pkg-config.freedesktop.org/releases/?C=M;O=D

@num3ric
num3ric / seqalignment.py
Created September 16, 2011 18:26
Sequence alignment - Dynamic programming algorithm
#!/usr/bin/python -O
import numpy as np
from numpy import array
A, C, G, T = 0, 1, 2, 3
int_to_char = {0:'A', 1:'C', 2:'G', 3:'T'}
#indel = -1
#scoring = array([[1,-1,-1,-1],
#[-1,1,-1,-1],
@mdPlusPlus
mdPlusPlus / compile_newest_stable_kernel_with_acso_patch.sh
Last active March 22, 2023 12:19
Download, patch, compile and install the newest stable Linux kernel with the ACS override patch (Ubuntu / Debian)
#!/bin/bash
function install_dependencies() {
echo "Installing dependencies..."
sudo apt -qq update
sudo apt -qq install -y curl git wget
# sudo apt -qq install -y bison flex kernel-package libelf-dev libssl-dev
sudo apt -qq install -y bison flex libelf-dev libssl-dev
}
@prenagha
prenagha / init.lua
Created September 30, 2016 00:36
Hammerspoon Config File, Hyper Key, Karabiner-Elements
-- hattip https://github.com/lodestone/hyper-hacks
-- hattip https://gist.github.com/ttscoff/cce98a711b5476166792d5e6f1ac5907
-- A global variable for the sub-key Hyper Mode
k = hs.hotkey.modal.new({}, 'F18')
-- Hyper+key for all the below are setup somewhere
-- The handler already exists, usually in Keyboard Maestro
-- we just have to get the right keystroke sent
@karloskalcium
karloskalcium / run_file_dependent_scripts.py
Last active July 27, 2023 12:41
chezmoi script to run scripts based on dependent files changing
#!/usr/bin/env python3.8
# requires python3.8
from typing import Dict, Final
import hashlib
import os
import subprocess
# Expects a file of the format output by sha256sum (text mode)
CHECKSUM_FILE: Final = ".local_checksum"
@fasiha
fasiha / no-hackerrank.md
Last active August 7, 2023 11:47
A prospective employer invited me to do a HackerRank test. Here's my proposed alternative.

Well, that was unexpected. In the following, I’m trying to follow Jon Evans’ advice from “The Terrible Technical Interview”.


To: recruitment@EmployerABC.com
From: Ahmed Fasih
Subject: Re: Programming Test Invitation

Hi there! Thanks for offering to let me take a HackerRank test for ABC, I appreciate the vote of confidence.

@dominic-p
dominic-p / zfs-dkms-fix.sh
Last active September 1, 2023 18:25
A simple script to automate rebuilding ZFS related DKMS modules after a kernel upgrade. USE WITH CAUTION.
#!/bin/sh
#
# --- zfs-dkms-fix.sh ---
#
# This script automates the process of fixing ZFS after a kernel
# update. See: https://github.com/zfsonlinux/zfs/issues/3801
###################################################################
# Get the current ZFS and SPL module versions
modversion=$(dkms status | cut -d , -f 2 | tail -n 1 | xargs)
@ttscoff
ttscoff / init.lua
Last active January 9, 2024 23:44
Hammerspoon config examples for hyper key
-- A global variable for the Hyper Mode
k = hs.hotkey.modal.new({}, "F17")
-- Trigger existing hyper key shortcuts
k:bind({}, 'm', nil, function() hs.eventtap.keyStroke({"cmd","alt","shift","ctrl"}, 'm') end)
-- OR build your own
launch = function(appname)
function ConvertGamesToITAD ($allGames) {
foreach ($group in $allGames | Group-Object -Property Name) {
$games = $group.Group
$playtime = ($games.Playtime | Sort-Object)[-1]
$status = ($games.CompletionStatus | Sort-Object)[-1]
@{
title = $games[0].Name
status = ([string]$status).ToLower()
playtime = $playtime / 60
copies = @(foreach ($game in $games) {