Skip to content

Instantly share code, notes, and snippets.

View todgru's full-sized avatar

todgru

  • Portland, OR
View GitHub Profile
@todgru
todgru / s3push.sh
Created August 9, 2022 18:42 — forked from ambanmba/s3push.sh
CurlPushToS3
#!/bin/bash
fileLocal="filename.ext"
bucket="name-of-bucket"
s3dir="nameofdirectory/"
region="us-east-2"
storageClass="STANDARD"
awsAccess='XXXXXXXXXXXXXXXXXXXX'
awsSecret='0000000000aaaaaaaaaa0000000000aaaaaaaaaa' #Make sure to use credentials with WRITE access to the bucket
@todgru
todgru / aws-signature-creator.sh
Created August 9, 2022 18:41 — forked from adrianbartyczak/aws-signature-creator.sh
A signature creator for AWS signature version 4
#!/usr/bin/env bash
#
# File:
# aws-signature-creator.sh
#
# Description:
# A signature creator for AWS signature version 4
#
# References:
# https://czak.pl/2015/09/15/s3-rest-api-with-curl.html
@todgru
todgru / rect-starlink-cable-hack.md
Created August 1, 2022 00:22 — forked from darconeous/rect-starlink-cable-hack.md
Hacking the Rectangular Starlink Dishy Cable
@todgru
todgru / ava-js-assertion-error.md
Last active June 27, 2022 20:52
ava avajs assertionerror global npx

Running tests using the globaly installed ava@4.x produces this error:

$ ava test.js

  Uncaught exception in test.js

  AssertionError [ERR_ASSERTION]: The expression evaluated to a falsy value:

 assert(refs.runnerChain)
@todgru
todgru / stream-mp3-to-remote-host.md
Last active December 30, 2022 17:47
stream mp3 to remote host

the ffmpeg version of the stream doesn't work for me on raspberry pi running ubuntu. likely an issue with how the hardware sound devices are setup.

ffmpeg -f alsa -i hw:0 -f mp3 - | \
    curl -s -k -H "Transfer-Encoding: chunked" -X POST -T - \
    "https://streammyaudio.com/YOURSTATIONNAME.mp3?stream=true&advertise=true"

this vlc version works. need full path to mp3. streaming a mp3 works. need to investigate streaming a playlist.

vlc -I dummy file:///home/ubuntu/some-mp3-file.mp3 --sout='#transcode{vcodec=none,acodec=mp3,ab=256,channels=2,samplerate=44100,scodec=none}:standard{access=file,mux=mp3,dst=-}' --no-sout-all --sout-keep | \
@todgru
todgru / date.md
Created June 13, 2022 17:57
set date command line linux
# date -s '2022-06-13 10:52:23'
Mon Jun 13 10:52:23 PDT 2022
# date
Mon Jun 13 10:52:25 PDT 2022

Or:

# date -s 'Mon Jun 13 10:52:23 PDT 2022'
Mon Jun 13 10:52:23 PDT 2022
@todgru
todgru / git-stats.md
Created June 2, 2022 17:03
simple gist stats from git log

git shortlog -sn --no-merges --since "DEC 31 2021"

@todgru
todgru / git-diff-target.md
Last active May 20, 2022 18:57
git diff current target feature branch

git diff between current and target branches

show only the changes added to target branch and not in the current checked out branch:

git diff ...target-branch

show only the changes in the current checked out branch and not in target branch:

@todgru
todgru / group-by-having.md
Created May 3, 2022 19:34
Collect rows by column and group by having count greater than. postgresql sql

Group the rows in the userLogins table by the userId column where the userName matches foo bar. If the count of those groups are greater than one, show the user id and count.

SELECT 
  "userId", count("userId")
FROM 
  "userLogins"
WHERE 
 "userName" = 'foo bar'
@todgru
todgru / sequelize-postgresql-transaction.md
Last active April 26, 2022 18:25
sequelize postgresql transactions