Skip to content

Instantly share code, notes, and snippets.

View dkebler's full-sized avatar

David Kebler dkebler

  • We Also Walk Dogs
  • Oregon, US
View GitHub Profile
@dkebler
dkebler / gulp-node-sass-bower
Last active August 29, 2015 14:20
Getting Gulp to find sass @imports within bower packages - node-sass
// Assumes you are using node-sass. Sadly this is not an automated solution.
// You have to know where the scss of each bower package is located
// if you add a package you'll have to add another config.bowerDir + '/path/to/package/scss/' to the sass task.
// some package scss have more @import lines to other scss so be sure to add those paths as well (like with foundation)
var gulp = require('gulp');
// Include Our Plugins
var sass = require('gulp-sass');
@dkebler
dkebler / Git push deployment in 7 easy steps.md
Last active October 6, 2015 04:16 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
@dkebler
dkebler / registers_MCP23017.cson
Created December 8, 2016 03:12
MCP23017 Register Code Database as cson file
# ww1.microchip.com/downloads/en/DeviceDoc/21952b.pdf
# see table 1.6 and details in sections 1.6.x following
# follow with two bytes to set both banks/ports A and B
# adding 1 to value will address bank/port B with a single byte, as long as bit 7 of IOCON = 0
registers: [
{
name:'IODIR'
alias:'DIRECTION'
value: 0x00
desc: 'When a bit is set, the corresponding pin becomes an input. When a bit is clear, the corresponding pin becomes an output.'
@dkebler
dkebler / get_latest_release.sh
Created December 4, 2017 18:37 — forked from lukechilds/get_latest_release.sh
Shell - Get latest release from GitHub
get_latest_release() {
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api
grep '"tag_name":' | # Get tag line
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value
}
# Usage
# $ get_latest_release "creationix/nvm"
# v0.31.4
@dkebler
dkebler / homeassistant.js
Created July 29, 2019 03:09
Access home assistant websocket api via nodej client and long lasting token
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'
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;
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()) {
@dkebler
dkebler / acl-share-dir.sh
Last active February 6, 2021 21:18
acl based directory share between users
#!/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 / !RebootToOs.md
Created April 21, 2021 17:50 — forked from Darkhogg/!RebootToOs.md
"Reboot to {OS}" scripts for rEFInd Next Boot selection

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 / store-starter.js
Last active September 23, 2021 16:04
Vue dynamic/reactive nested/deep property setting and getting with vuex store
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: {