Skip to content

Instantly share code, notes, and snippets.

View snahor's full-sized avatar

Hans Roman snahor

  • Wakanda
View GitHub Profile
@NotMedic
NotMedic / Instructions.txt
Created December 2, 2018 02:29
Siri -> HomeBridge -> HomeBridge-ssh -> iptables
This is a pretty simple setup:
Siri is used to control Homebridge using the HomeKit protocol.
Homebridge has a module named Homebridge-ssh that allows you to run commands over ssh.
There is a shell script on an OpenWrt box to enable, disable, and check the status of a MAC Address block in the FORWARD table.
1. Install node on your platform. I went with 8.9 for no specific reason other than I initially had issues with 10 that probably weren't related..
2. Install homebridge and homebridge-ssh. You should probably also put hombridge-config-ui-x on there too... I used the unsafe-perm parameter after getting a significant number of errors:
sudo -i npm install -g homebridge --unsafe-perm
sudo -i npm install -g homebridge-ssh --unsafe-perm
package jwtex
import (
"encoding/base64"
"encoding/json"
"fmt"
"strings"
"testing"
)
@ScriptingSquirrel
ScriptingSquirrel / export-node-stats.md
Last active April 4, 2023 02:18
Setup prometheus-node-exporter and push stats to Pushgateway with cron job

(Assuming a Debian 8-like system)

  • Install prometheus-node-exporter

    $ sudo apt update && sudo apt install prometheus-node-exporter
  • Configure prometheus-node-exporter to expose metrics only to localhost, not on to all networks. Modify file /etc/default/prometheus-node-exporter:

    # Set the command-line arguments to pass to the server.
@kentcdodds
kentcdodds / create-required-context.js
Created May 15, 2018 22:31
create react context that has a validated consumer.
// create a React context Provider/Consumer pair that
// validates the consumer is rendered within a provider
function createRequiredContext(name) {
const Context = React.createContext()
function Consumer(props) {
return (
<Context.Consumer {...props}>
{val => {
if (!val) {
@elifiner
elifiner / indent.php
Last active June 11, 2022 20:27
Indent and de-indent multiline strings in PHP
<?php
function dedent($str)
{
$parts = array_filter(explode("\n", $str), function($part) {
return trim($part);
});
$spaces = min(array_map(function($part) {
preg_match('#^ *#', $part, $matches);
return strlen($matches[0]);
@steven2358
steven2358 / ffmpeg.md
Last active May 5, 2024 12:45
FFmpeg cheat sheet
@arehmandev
arehmandev / .drone.yml
Created January 28, 2018 12:09 — forked from d0x2f/.drone.yml
.drone.yml example
workspace:
base: /build
pipeline:
build-image:
image: docker
commands:
# Build development target, which includes xdebug.
# Tag with both api-build:<build_number> and api-build:latest.
From 38c48252f528b00ba0b4fd2d1a364b91c694a4ac Mon Sep 17 00:00:00 2001
From: Stephen Brennan <stephen@brennan.io>
Date: Thu, 28 Dec 2017 15:14:59 -0800
Subject: [PATCH] fs: when reading mp3 files, only play Shake It Off
---
fs/open.c | 31 ++++++++++++++++++++++++++++++-
1 file changed, 30 insertions(+), 1 deletion(-)
diff --git a/fs/open.c b/fs/open.c
@giannisp
giannisp / gist:1ed3665af198f62271712569e14ac808
Created October 20, 2017 18:10
Ubuntu 17.10 - Move window buttons to the left
# Move to the left
gsettings set org.gnome.desktop.wm.preferences button-layout 'close,maximize,minimize:'
# Move to the right
gsettings set org.gnome.desktop.wm.preferences button-layout ':close,maximize,minimize'
@mayukh18
mayukh18 / flask_setup_heroku.md
Created September 28, 2017 19:38
How to setup flask app with database on heroku

Setting up flask app in heroku with a database

The below article will cover the intricacies of setting up databases and heroku in respect to a flask app. This is more like a memo and will have out of sequence instructions or solutions to errors so read thoroughly.

Setting up a database

You'll need the packages