Skip to content

Instantly share code, notes, and snippets.

View phansch's full-sized avatar
Resuming OSS work

Phil Hansch phansch

Resuming OSS work
View GitHub Profile
@youhide
youhide / build.yml
Created October 25, 2019 18:45
GitHub Actions - Build for Windows, MacOS, Linux and release on tag.
name: Node CI
on:
push:
tags:
- 'v*'
jobs:
upload-release:
@jinnko
jinnko / patch-killer-firmware.zsh
Last active January 9, 2021 21:45
Automate patching Killer Wireless firmware on Ubuntu for Dell XPS 9370
#!/usr/bin/env zsh
#
# See the following AskUbuntu question for why this is a thing
# https://askubuntu.com/questions/1024281/dell-xps-13-9370-bluetooth-issues/1148484#1148484
#
# As the overwritten files are owned by the linux-firmware package you may want to add this
# script to an @reboot cron of the root user.
#
# This script uses the Windows driver package as the src of the firmware bin files. This can
# be acquired from https://www.dell.com/support/home/uk/en/ukbsdt1/drivers/driversdetails?driverId=1JVK3
@henrik
henrik / 1-exhaustive_case_exact_match.rb
Last active April 15, 2019 09:54
Experimental Ruby exhaustive conditionals that raise if no branch matches. A bit like in e.g. Elm.
# This replaces conditions like: `case …; when …; when …; else raise "Nothing matched!"` if an exact match is all you need.
def cond(input, hash)
hash.fetch(input) { raise "No branch for #{input.inspect}!" }.call
end
input = :good
cond(input,
good: -> { puts "So good!" },
bad: -> { puts "So bad!" },
@mrk-han
mrk-han / emulator-install-using-avdmanager.md
Last active April 16, 2024 14:43
Installing and creating Emulators with AVDMANAGER (For Continuous Integration Server or Local Use)

Install and Create Emulators using AVDMANAGER and SDKMANAGER

TL;DR

For an emulator that mimics a Pixel 5 Device with Google APIs and ARM architecture (for an M1/M2 Macbook):

  1. List All System Images Available for Download: sdkmanager --list | grep system-images

  2. Download Image: sdkmanager --install "system-images;android-30;google_atd;arm64-v8a"

@anna-is-cute
anna-is-cute / travis_cache.md
Last active April 21, 2020 21:40
Rust and Travis CI cache

Rust and Travis CI cache

Using Travis CI's cache is very useful and helps cut Rust job times way, way down. However, the way that the default caching for Cargo is set up means it will quickly bloat.

Travis currently checks ~/.cargo and target/ for any changes from the current cache after a build. There will always be changes in target/ if the source has changed, which it usually does when a Travis build runs. This means new incremental object files, fingerprints, and build script compilation files are being added to the cache every build.

@odigity
odigity / knex.js
Last active February 2, 2021 14:34
Wrapping a unit test in a transaction for easy cleanup with Knex.js
#!/usr/bin/node
const Promise = require('bluebird')
const config = require('./config.json')
const knex = require('./lib/knex')(config.database).connection()
const mock = () => ({ user_id: Math.floor(Math.random() * 999) + 1, payload_type: 'foo', attributes: JSON.stringify({}) })
const before = (t) => {
@phansch
phansch / yardoc_cheatsheet.md
Last active March 1, 2024 18:17 — forked from chetan/yardoc_cheatsheet.md
Improved YARD cheatsheet
@CoryFoy
CoryFoy / analytics.rb
Last active July 18, 2023 21:01
An example of calling the Analytics API using machine creds and the V4 API from Ruby
require 'google/apis/analyticsreporting_v4'
require 'googleauth'
include Google::Apis::AnalyticsreportingV4
include Google::Auth
VIEW_ID = "12345678" #your profile ID from your Analytics Profile
SCOPE = 'https://www.googleapis.com/auth/analytics.readonly'
@client = AnalyticsReportingService.new
@zmalltalker
zmalltalker / gist:5900206
Last active November 3, 2016 12:59
Install ruby-install, chruby and ruby 1.9.3 on Centos - Install puppet - Run `puppet apply <(curl -S https://gist.github.com/zmalltalker/5900206/raw/b9d7c2263cef981a8384a4e2b513e67c70060436/gistfile1.pp)`
# chruby
# ruby-install
# ruby 1.9.3
# /etc/profile.d/chruby.sh
Exec {
path => ["/bin","/usr/bin", "/usr/local/bin"]
}
file { "/etc/profile.d/chruby.sh":
ensure => present,
@jordelver
jordelver / gist:5806460
Created June 18, 2013 15:41
Sharing files using netcat

Sharing files using netcat

The receiver

nc -l 5566 > data-dump.sql

Listen on port 5566 and redirect output to data-dump.sql

The sender