Skip to content

Instantly share code, notes, and snippets.

@hkennyv
hkennyv / README.md
Last active January 21, 2021 04:38
benchmarks

sqlite benchmark (single-threaded)

khuynh@kmba:temp/bld $ hyperfine --warmup 3 --prepare 'make clean' 'make -j 1'
Benchmark #1: make -j 1
  Time (mean ± σ):     70.833 s ±  0.235 s    [User: 68.987 s, System: 1.267 s]
  Range (min … max):   70.405 s … 71.105 s    10 runs
@hkennyv
hkennyv / jupyter-virtualenv.md
Last active September 8, 2020 17:25
jupyter virtalenv
$ python -m virtualenv myvenv
$ source myvenv/bin/activate
(venv) $ pip install ipykernel
(venv) $ ipython kernel install --user --name=myvenv
@hkennyv
hkennyv / README.md
Created August 3, 2020 03:42
adding private package to requirements.txt

The syntax for adding a private package to a python requirements.txt is shown in the sample requirements.txt file. This assumes that the client that is installing the package has the proper permissions to access the file. In my case, using bitbucket pipelines, I can create an SSH key for the pipeline and add it as a read-only access key to my bitbucket repository.

It is typically:

git+ssh://git@bitbucket.org/<fork>/<reponame>.git
@hkennyv
hkennyv / README.md
Last active October 30, 2019 20:41
Virutal Serial Ports with socat

Virtual Serial Ports with socat

author(s): khuynh

Overview

I found this great resource online about using socat to create virtual serial ports. This is extremely useful for testing code that interfaces with a serial port. I'm documenting this here so I can have refer to later. I'll provide a script that opens two new virutal serial ports that you can read & write from as well.

The documentation for socat is located here.

@hkennyv
hkennyv / tail-slack.sh
Created August 27, 2019 00:03
tail-slack
#!/bin/bash
# tail-slack.sh
# author(s): khuynh
# description: this script tails log files and posts them to a slack channel
# when a new line is appended to the file. It is a modified version of:
# https://blog.getpostman.com/2015/12/23/stream-any-log-file-to-slack-using-curl/
#
# usage:
# $1 - SLACK_URI
@hkennyv
hkennyv / README.md
Last active August 5, 2019 17:52
slack-logger

slack-logger

A script used to tail a logfile and post newlines to a slack webhook. Original script taken from this Postman Blog. In practice, I expect that it will be modified slightly (it'd be nice to know the name of the file it's tailing).

Usage

Download or copy the slack-logger.sh file.

Make the shell script executable using:

@hkennyv
hkennyv / README.md
Last active February 23, 2019 00:28
mounting a windows network drive on raspberry pi

Description

This gist will cover mounting a network drive to your raspberry pi. This is being tested on a raspberry pi running Raspbian Stretch.

The process is assuming you have a windows network drive already setup on your network and the proper permissions configured. The following snippet shows our assumptions:

ip = 192.168.1.10

windowsUser = user1
userPass = password
@hkennyv
hkennyv / README.md
Last active April 9, 2019 18:05
headless pi setup

Procedure for headless raspberrypi setup

Once a new raspbian image is flashed onto your microSD card, navigate to the root of the microSD card.

Add a new file with nothing in it to the root directory called "ssh". This can be achieved on unix-like systems using the touch ssh command.

Add a new file to the root directory titled "wpa_supplicant.conf". You can copy and paste the contents of wpa_supplicant.conf into it.

Replace with your network name. Note the double quotation marks around it. Replace with your password. Note the double quotation marks around it.