Skip to content

Instantly share code, notes, and snippets.

Keyvan Fatehi kfatehi

Block or report user

Report or block kfatehi

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
kfatehi / 1pass_dups.js
Last active May 19, 2019 — forked from thehesiod/
1password duplicate remover (alpha, only run in debugger with breakpoints everywhere *g*)
View 1pass_dups.js
// you need `op` tool for this, download it here
// create items.json like so:
// op list items | jq > items.json
// then run this script
// this script outputs uuids of dupes as keyed by item title, create, and modified date,
// feed it into the delete command like so:
// node process.js | xargs -I{} op delete item {}
const items = require('./items.json');
View nvidia.js
const { exec } = require('child_process');
const getGPUList = async () => {
return new Promise(function(resolve, reject) {
exec('nvidia-smi -L', (err, stdout, stderr) => {
if (err) return reject(err);
let gpuMap = stdout.trim().split('\n').reduce((acc, line)=>{
let [_, numStr, uuid] = line.match(/GPU (\d+):.+UUID: (.+)\)/)
return {...acc, [uuid]: numStr}
}, {});
View autofan.js
const nvidia = require('./src/nvidia');
const TARGET_TEMP = 69;
let timeouts = [];
let interval = null;
async function autofan(gpus, uuid, tempTarget) {
const tick = async () => {
let gpu_int = gpus[uuid];
View gist:07bdef95c132215598a23caf4ce7c2f5
set -exuo pipefail
if [[ ! $# -eq 1 ]]; then
echo "usage: $0 <URL>"
exit 1
# Referencing FFMpeg to Icecast2 Streaming Sample Gist:
URL=$(streamlink $LIVESTREAM_URL worst --stream-url)
kfatehi / PKGBUILD
Last active Mar 23, 2018
ripcord PKGBUILD
# Basing this off upwork-appimage.git and gulden-appimage
pkgdesc="A desktop chat client for Discord (and soon Slack)"
kfatehi /
Created Mar 14, 2018 — forked from P7h/
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].
sudo yum -y remove tmux
sudo yum -y install wget tar libevent-devel ncurses-devel
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;
kfatehi / server.js
Created Nov 29, 2017
fireplace server
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)}
kfatehi /
Created Sep 13, 2017
Generates a PDF from a barcode string for the Keyport Barcode Insert Raw
# Generates a PDF from a barcode string
# in the dimensions expected for a Keyport Barcode Insert
# You may need to set SYMBOLOGY and/or remove -c (checksum)
# depending on which barcode you're creating
kfatehi / prs.js
Created Mar 14, 2017
list pull requests across entire organization
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' })
You can’t perform that action at this time.