Skip to content

Instantly share code, notes, and snippets.

View gonzalo-bulnes's full-sized avatar

Gonzalo Bulnes Guilpain gonzalo-bulnes

View GitHub Profile
#!/bin/bash
# Utility script for Qubes OS 4.1, to prepare vidchat VMs.
# Handles attaching web & mic, also raises scheduling priority
# to ensure that the vidchat VM stays snappy (reduces jitter).
set -eu -o pipefail
# Default to vidchat, but support overriding
default_vm="${VIDCHAT_VM=vidchat}"
target_vm="${1:-$default_vm}"
@conorsch
conorsch / vidchat.sh
Created November 2, 2021 22:09
Utility script for Qubes OS, to prepare vidchat VMs.
#!/bin/bash
# Utility script for Qubes OS, to prepare vidchat VMs.
# Handles attaching web & mic, also raises scheduling priority
# to ensure that the vidchat VM stays snappy (reduces jitter).
set -eu -o pipefail
# Default to vidchat, but support overriding
default_vm="${VIDCHAT_VM=vidchat}"
target_vm="${1:-$default_vm}"
#!/bin/bash
export __NV_PRIME_RENDER_OFFLOAD=1
export __GLX_VENDOR_LIBRARY_NAME=nvidia
export __VK_LAYER_NV_optimus=NVIDIA_only
export VK_ICD_FILENAMES=/usr/share/vulkan/icd.d/nvidia_icd.json
exec "$@"
@bcduggan
bcduggan / qubes-salt-pillar-tags.md
Last active October 23, 2023 06:42
Target Qubes VMs with tags in Salt Pillar data

Target Qubes VMs with tags in Salt Pillar data

Qubes allows users to target VMs in top files using pillar data:

base:
  qubes:type:app:
    - match: pillar
    - a_state
@mandykoh
mandykoh / refizzbuzz.rb
Created February 14, 2019 12:05
FizzBuzz with Regexes
#!/usr/bin/env ruby
@parts = ''
(0...100).each { |i| @parts += ',' + (i + 1).to_s }
def mark(n, label)
@parts.gsub! /((,\w+){#{n - 1}})(,\w+)/, "\\1,#{label}"
end
mark 3, 'Fizz'
@TJC
TJC / apparent_temp.scala
Last active February 8, 2019 06:15
apparent temperature equation
// rh = relative humidity, in range from 0.0 to 1.0
// t = temperature (celcius), typically in range from -10 to 50
// v = wind speed (m/s)
def vp(rh: Double, t: Double) = rh * 6.105 * Math.exp( (17.27 * t) / (237.7 + t))
def at(t: Double, rh: Double, v: Double) = t + (0.33 * vp(rh, t)) - (0.7 * v) - 4.00
@colingourlay
colingourlay / idle-analytics.js
Created September 7, 2016 07:41
Defer the standard Google Analytics script until the page is idle, in supported browsers.
(function(x,y,z){(x[y]&&x[y](z))||z()})(window,'requestIdleCallback',function(){
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXX-X', 'auto');
ga('send', 'pageview');
});
@lucaswilric
lucaswilric / kite.rb
Last active April 16, 2019 06:22
Open Buildkite for the current repo and branch
#!/usr/bin/env ruby
# Open Buildkite builds for the current repo and branch
# Tested on OSX 10.10.5
repo = `git info | grep remote.origin.url | sed -nE 's/.*github\.com[\:\/](.*)\.git/\\1/p'`.chomp
buildkite_slug = repo.gsub('_', '-')
branch = ARGV.length > 0 ? ARGV[0] : `git rev-parse --abbrev-ref HEAD`.chomp
`open https://buildkite.com/#{buildkite_slug}/builds?branch=#{branch}`
^([0-9]+)-(0[1-9]|1[012])-(0[1-9]|[12][0-9]|3[01])[Tt]([01][0-9]|2[0-3]):([0-5][0-9]):([0-5][0-9]|60)(\.[0-9]+)?(([Zz])|([\+|\-]([01][0-9]|2[0-3]):[0-5][0-9]))$