Skip to content

Instantly share code, notes, and snippets.

Avatar

David Kebler dkebler

  • We Also Walk Dogs
  • Oregon, US
View GitHub Profile
@dkebler
dkebler / widevine.sh
Last active Mar 27, 2022
Install WidevineCDM into chromium
View widevine.sh
#!/bin/bash
# -eux
function confirm()
{
echo -n "$@ "
read -e answer
for response in y Y yes YES Yes Sure sure SURE OK ok Ok
do
if [ "_$answer" == "_$response" ]
then
@dkebler
dkebler / evdi-install.sh
Last active Nov 1, 2021
install the forked evdi module for amd gpu
View evdi-install.sh
#!/bin/bash
# remove default evdi module and build and install this fork
# clone this https://github.com/pioto1225/evdi/tree/amd_vmap_texture
# put this script in the parent directory
echo "**** this script must be run from the parent of the the evdi repo ****"
ls -la /usr/src | grep evdi
echo enter the latest evdi driver version
read version
echo "***** moving /usr/src/evdi-$version to evdi-$version.original ****"
sudo mv /usr/src/evdi-$version evdi-$version.original
@dkebler
dkebler / !RebootToOs.md
Created Apr 21, 2021 — forked from Darkhogg/!RebootToOs.md
"Reboot to {OS}" scripts for rEFInd Next Boot selection
View !RebootToOs.md

Reboot to {OS}

This a collection of notes and files used in my quest to create "Reboot to Windows" and "Reboot to Linux" scripts (and desktop shortcuts) for Linux and Windows respectively that automatically reboot my system and instruct rEFInd to auto-select the appropriate OS entry.

General Information

The key for achieving this is to modify the EFI Variable PreviousBoot with GUID 36d08fa7-cf0b-42f5-8f14-68df73ed3740, which rEFInd uses to store the last entry selected in the menu and, if using the + default entry, will be used to select the default OS. By doing this, we trick rEFInd into booting the OS we choose without having to be physically there to press the keyboard.

@dkebler
dkebler / acl-share-dir.sh
Last active Feb 6, 2021
acl based directory share between users
View acl-share-dir.sh
#!/bin/bash
# Usage:
# share_dir [ -o <owner> -g <group> ] <directory> <list of space delimited users names/uid>
# use . for current directory
# -o forces own for directory, default is $USER
# -g forces group name for directory, default is "users" and if not available then $USER
# Note: script operates recursively on given directory!, use with caution
## HELPERS
@dkebler
dkebler / hugo-update.sh
Created Sep 26, 2020
Hugo Release Update Script - supports extended version
View hugo-update.sh
#!/bin/bash
# Version 0.21.0 8:26 PST, Nov 9, 2018
# inspried from this forum post https://discourse.gohugo.io/t/script-to-install-latest-hugo-release-on-macos-and-ubuntu/14774/10
# if you have run into github api anonymous access limits which happens during debugging/dev then add user and token here or sourced from a separate file
# . ~/githubapitoken
#GITHUB_USER=""
#GITHUB_TOKEN=""
if [ "$GITHUB_TOKEN" != "" ]; then
echo using access token with script
View sender.js
const net = require("net"), fs = require("fs");
let server, istream = fs.createReadStream("./sender/SC-02.pdf");
server = net.createServer(socket => {
socket.pipe(process.stdout);
istream.on("readable", function () {
let data;
while (data = this.read()) {
View receiver.js
const net = require("net"), fs = require("fs"), remote_server = process.argv[2];
let socket;
socket = remote_server ? net.connect(8000, remote_server) : net.connect(8000);
let ostream = fs.createWriteStream("./receiver/SC-02.pdf");
let date = new Date(), size = 0, elapsed;
socket.on('data', chunk => {
size += chunk.length;
elapsed = new Date() - date;
@dkebler
dkebler / rock64shrink.sh
Last active Apr 10, 2021
Bash Script for Shrinking/Truncating a disk image
View rock64shrink.sh
#!/bin/bash
# WARNING this script could easily trash a image or worse a device. DO NOT USE IT WITH A DEVICE
# It will make a copy of the image to work on by default unless you use the -o option
# which you should NOT unless your image is much bigger than >16GB
# In other words test it on a disk image file that could be damaged.
# Use the -h option to see list of options
# You MUST use -t to do the last step truncation
@dkebler
dkebler / homeassistant.js
Created Jul 29, 2019
Access home assistant websocket api via nodej client and long lasting token
View homeassistant.js
import to from 'await-to-js'
import ha from 'home-assistant-js-websocket'
import WebSocket from 'ws'
import { EventEmitter } from 'events'
import ndb from 'debug'
const debug = ndb('home-assistant:ws')
const MSG_TYPE_AUTH_REQUIRED = 'auth_required'
const MSG_TYPE_AUTH_INVALID = 'auth_invalid'
const MSG_TYPE_AUTH_OK = 'auth_ok'
@dkebler
dkebler / store-starter.js
Last active Sep 23, 2021
Vue dynamic/reactive nested/deep property setting and getting with vuex store
View store-starter.js
import Vue from 'vue'
import Vuex from 'vuex'
import { setProp, getProp } from 'vue-properties'
import traverse from 'traverse'
import isPlainObj from 'is-plain-object'
Vue.use(Vuex)
const store = new Vuex.Store({
state: {