Skip to content

Instantly share code, notes, and snippets.

View drbh's full-sized avatar
🕳️
a for AI

drbh drbh

🕳️
a for AI
  • drbh
  • state space
  • 02:52 (UTC -04:00)
View GitHub Profile
@drbh
drbh / add_ssh_alias.sh
Created March 26, 2018 18:13
Easy way to add an alias to bash profile
#!/bin/bash
echo 'Lets add a new SSH alias\n\n'
read -n 1 -s -r -p "[Press any key to continue]"
echo '\n\n'
echo 'Alias Name (my ssh)'
read aliasname
echo 'Username (OS specific. eg Ubuntu:ubuntu AmazonLinux:ec2-user)'
read username
@drbh
drbh / screen2gif.sh
Created March 26, 2018 18:27
make screenshots into gifs easily with this function
screen2gif() {
ffmpeg -i $1 -s 1200x800 -pix_fmt rgb24 -r 20 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif
}
@drbh
drbh / slack-cleaner.js
Last active March 26, 2018 18:55
forked and edited slack cleaner - should be a command line app - or lambda function
var https = require('https');
// CONFIGURATION
var token = 'YOUR TOKEN';
var channel = 'THE CHANNEL ID (not name) YOU WANT TO CLEAN';
var privateChannel = false;
var isDirectMessage = true
var delay = 300; // delay between delete operations in millisecond
// GLOBALS
var channelApi = privateChannel ? 'groups' : 'channels';
var channelApi = isDirectMessage ? 'conversations' : privateChannel
@drbh
drbh / toggle_icons.sh
Created June 5, 2018 17:43
toggle desktop icons on mac
hide_desktop_icons(){
defaults write com.apple.finder CreateDesktop false && killall Finder
}
show_desktop_icons(){
defaults write com.apple.finder CreateDesktop true && killall Finder
}
toggle_icons(){
if [ "$(defaults read com.apple.finder CreateDesktop)" == "false" ]; then
echo "Showing Icons"
@drbh
drbh / download-sketch-app.sh
Created September 11, 2018 23:56
re-download Sketch application with a script. Avoids trial timeout period
#!/bin/sh
rm -rf /Applications/Sketch.app/ && \
echo "Removed Sketch from Applications" && \
rm -rf /tmp/sketch_tmp_dir/
mkdir /tmp/sketch_tmp_dir && \
cd /tmp/sketch_tmp_dir && \
curl -sS https://download.sketchapp.com/sketch-51.3-57544.zip > file.zip && \
echo "Downloaded Sketch 51.3" && \
unzip -q file.zip && \
rm file.zip && \
@drbh
drbh / isogram.c
Created November 7, 2018 03:56
Determine if a word or phrase is an isogram. An isogram (also known as a "nonpattern word") is a word or phrase without a repeating letter, however spaces and hyphens are allowed to appear multiple times. Examples of isograms: lumberjacks background downstream six-year-old The word isograms, however, is not an isogram, because the s repeats.
#include "isogram.h"
#include "string.h"
#include "ctype.h"
// simple Key/Value struct
struct Map {
int Key;
int Value;
};
@drbh
drbh / get_slack_id
Created January 9, 2019 19:09
click on a message with yourself in slack and enter this in the console to get your user id
alert("User Id: "+ jQuery("span.presence.active").attr("data-member-presence"))
@drbh
drbh / websocket-lambda-handler.py
Created January 17, 2019 15:55
This script directs websocket requests and sessions with DynamoDB and another Lambda function as the game logic.
import json
import time
import sys
import os
import base64
import datetime
import hashlib
import hma
from botocore.vendored import requests
import boto3
@drbh
drbh / checkIsBrave.js
Created January 30, 2019 20:19
Reliably detect Brave Browser with native JS
// helper to find Brave in User Agent string
function isBraveAgent(userAgentResponse) {
var isBraveIndex = ~userAgentResponse.indexOf('Brave')
if (isBraveIndex < 0) {
return true
}
return false
}
// Function from Javarome
@drbh
drbh / docker-compose.yml
Created March 15, 2019 19:29
start to nucypher docker network
version: '3'
services:
nucypher-alice:
command: nucypher alice run --dev --network devnet --teacher-uri 18.222.119.242:9151
environment:
- NUCYPHER_SENTRY_LOGS=0
image: nucypher:latest
container_name: nucypher-alice
ports: