Instantly share code, notes, and snippets.

View PKGBUILD
# Basing this off upwork-appimage.git and gulden-appimage
# https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=gulden-appimage
# https://aur.archlinux.org/cgit/aur.git/tree/PKGBUILD?h=upwork-appimage
_pkgname=ripcord
_upkgname=Ripcord
pkgname=ripcord-appimage
pkgver=0.2.83
pkgrel=1
pkgdesc="A desktop chat client for Discord (and soon Slack)"
arch=('x86_64')
View tmux_build_from_source_CentOS.sh
# 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}
View gist:6b4481054a953cb9af17393b6f4c0ba2
#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;
View server.js
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)}
}
View keyport-barcode.sh
#!/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"
View prs.js
var Promise = require('bluebird')
var GitHubApi = require("github");
const org = "matrix-hacks";
var github = new GitHubApi({ Promise });
github.repos.getForOrg({ org, type: 'sources' })
.then(res=>res.data.map(i=>i.name))
.then(repos=>{
View gen-docset.sh
#!/bin/bash
set -e
DOCSET_NAME="MatrixJSSDK"
cat <<EOF > docset-config.json
{
"docset" : {
"name": "$DOCSET_NAME",
"icon": "scripts/icon.png"
}
}
View test.js
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);
View gist:7d4283be92dc82d5d1380e229e3b659e
'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)
View sync.js
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);
});
});