Skip to content

Instantly share code, notes, and snippets.

@kfatehi
kfatehi / tmux_build_from_source_CentOS.sh
Created March 14, 2018 23:51 — forked from P7h/tmux__CentOS__build_from_source.sh
tmux 2.0 and tmux 2.3 installation steps for Ubuntu. Or build from tmux source v2.5 for Ubuntu and CentOS.
# Steps to build and install tmux from source.
# Takes < 25 seconds on EC2 env [even on a low-end config instance].
VERSION=2.6
sudo yum -y remove tmux
sudo yum -y install wget tar libevent-devel ncurses-devel
wget https://github.com/tmux/tmux/releases/download/${VERSION}/tmux-${VERSION}.tar.gz
tar xzf tmux-${VERSION}.tar.gz
rm -f tmux-${VERSION}.tar.gz
cd tmux-${VERSION}
#include <SimpleTimer.h>
SimpleTimer timer;
int outPin = 9; // output pin (relay)
int inPin = 8; // choose the input pin (for a pushbutton)
int outVal = LOW;
int val = 0; // variable for reading the pin status
int prevVal = 0;
@kfatehi
kfatehi / server.js
Created November 29, 2017 07:49
fireplace server
root@fireplace:~# cat server.js
var fs = require('fs');
var http = require('http');
const PORT=80;
function write(file, content) {
try {fs.writeFileSync(file, content)}
catch (err) {console.error(err.message)}
}
@kfatehi
kfatehi / keyport-barcode.sh
Created September 13, 2017 22:59
Generates a PDF from a barcode string for the Keyport Barcode Insert Raw
#!/bin/bash
# Generates a PDF from a barcode string
# in the dimensions expected for a Keyport Barcode Insert
# https://www.mykeyport.com/barcode-insert
# You may need to set SYMBOLOGY and/or remove -c (checksum)
# depending on which barcode you're creating
SIZE="1.3x0.35"
UNITS="in"
SYMBOLOGY=${SYMBOLOGY:-"39"}
CODE="$1"
@kfatehi
kfatehi / _list-github-pull-requests.md
Last active May 27, 2024 16:04
list pull requests across entire organization
@kfatehi
kfatehi / gen-docset.sh
Created March 12, 2017 21:07
generate matrix-js-sdk docset
#!/bin/bash
set -e
DOCSET_NAME="MatrixJSSDK"
cat <<EOF > docset-config.json
{
"docset" : {
"name": "$DOCSET_NAME",
"icon": "scripts/icon.png"
}
}
@kfatehi
kfatehi / test.js
Created March 5, 2017 02:10
puppet get avatar url for matrix user id
const { Puppet } = require("matrix-puppet-bridge");
const puppet = new Puppet('./config.json');
puppet.startClient().then(()=>{
let client = puppet.getClient();
const getAvatarUrlForMatrixUser = (uid) => {
client.getProfileInfo(uid, 'avatar_url').then(({avatar_url})=>{
if (avatar_url) {
console.log('has avatar url', avatar_url);
'use strict';
var width = 300;
var height = 300;
var radius = Math.min(width, height) / 2;
var donutWidth = 75;
var color = d3.scaleOrdinal(d3.schemeCategory20b);
var svg = d3.select('#chart')
.append('svg')
.attr('width', width)
.attr('height', height)
@kfatehi
kfatehi / sync.js
Created January 21, 2017 04:29
matrix sync m.direct
const { Puppet } = require("matrix-puppet-bridge");
const puppet = new Puppet('./config.json');
puppet.startClient().then(()=>{
let client = puppet.getClient();
client.on('sync', (state) => {
if ( state === 'PREPARED' )
console.log(client.store.accountData['m.direct'].event.content);
});
});
@kfatehi
kfatehi / info.txt
Created January 10, 2017 06:00
notes on adding tls to matrix appservice bridge
Tracing from matrix-appservice-imessage on down through the turtle stack:
The call bridge.run(port, config) makes the server listen:
https://github.com/kfatehi/matrix-appservice-imessage/blob/master/index.js#L181
bridge.run, as defined in matrix-appservice-bridge, calls `appService.listen(port)`:
https://github.com/matrix-org/matrix-appservice-bridge/blob/master/lib/bridge.js#L253