Skip to content

Instantly share code, notes, and snippets.

View shayelkin's full-sized avatar

Shay Elkin shayelkin

View GitHub Profile
@onderweg
onderweg / inkbird.js
Last active December 7, 2023 09:50
Read temperature and humidity data from Inkbird ibs-TH1.
const DATA_HND = 0x002d;
const parseData = (data) => {
const rawTemp = data.readInt16LE(0);
const rawHum = data.readInt16LE(2);
return {
temperature: rawTemp / 100,
humidity: rawHum / 100
}
}
@Dnile
Dnile / scribe-ubuntu
Last active February 11, 2018 19:03
#!/bin/bash
echo "Install the necessary tools"
sudo apt-get update
sudo apt-get -y install make flex bison libtool libevent-dev automake pkg-config libssl-dev libboost-all-dev libbz2-dev build-essential g++ python-dev git
echo "git cloning Thrift"
apt-
@cdiener
cdiener / asciinator.py
Last active January 5, 2023 17:24
Convert image to ascii art
import sys; from PIL import Image; import numpy as np
chars = np.asarray(list(' .,:;irsXA253hMHGS#9B&@'))
if len(sys.argv) != 4: print( 'Usage: ./asciinator.py image scale factor' ); sys.exit()
f, SC, GCF, WCF = sys.argv[1], float(sys.argv[2]), float(sys.argv[3]), 7/4
img = Image.open(f)
S = ( round(img.size[0]*SC*WCF), round(img.size[1]*SC) )
img = np.sum( np.asarray( img.resize(S) ), axis=2)
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

@ssimeonov
ssimeonov / super_simple_sqs.rb
Created April 4, 2011 01:33
This is a simple way to post a message to Amazon SQS w/o any gems (the queue must already exist)
module Amazon
module Authentication
SIGNATURE_VERSION = "2"
@@digest = OpenSSL::Digest::Digest.new("sha256")
def sign(auth_string)
Base64.encode64(OpenSSL::HMAC.digest(digester, aws_secret_access_key, auth_string)).strip
end
def digester