Skip to content

Instantly share code, notes, and snippets.

@todgru
todgru / gfm-images.md
Last active Aug 10, 2022
github flavored markdown customizing image width and alt using html tags
View gfm-images.md
<img width="50" alt="Diamond Head, Honolulu, HI and the blue Pacific Ocean" src="https://avatars.githubusercontent.com/u/1738885?v=4">
<img width="100" alt="Diamond Head, Honolulu, HI and the blue Pacific Ocean" src="https://avatars.githubusercontent.com/u/1738885?v=4">
<img width="200" alt="Diamond Head, Honolulu, HI and the blue Pacific Ocean" src="https://avatars.githubusercontent.com/u/1738885?v=4">
<img width="300" alt="Diamond Head, Honolulu, HI and the blue Pacific Ocean" src="https://avatars.githubusercontent.com/u/1738885?v=4">
<img width="400" alt="Diamond Head, Honolulu, HI and the blue Pacific Ocean" src="https://avatars.githubusercontent.com/u/1738885?v=4">
<img width="500" alt="Diamond Head, Honolulu, HI and the blue Pacific Ocean" src="https://avatars.githubusercontent.com/u/1738885?v=4">

50

@todgru
todgru / s3push.sh
Created Aug 9, 2022 — forked from ambanmba/s3push.sh
CurlPushToS3
View s3push.sh
#!/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 Aug 9, 2022 — forked from adrianbartyczak/aws-signature-creator.sh
A signature creator for AWS signature version 4
View aws-signature-creator.sh
#!/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 Aug 1, 2022 — forked from darconeous/rect-starlink-cable-hack.md
Hacking the Rectangular Starlink Dishy Cable
View rect-starlink-cable-hack.md
@todgru
todgru / ava-js-assertion-error.md
Last active Jun 27, 2022
ava avajs assertionerror global npx
View ava-js-assertion-error.md

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 Jun 17, 2022
stream mp3 to remote host
View stream-mp3-to-remote-host.md

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 Jun 13, 2022
set date command line linux
View date.md
# 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 Jun 2, 2022
simple gist stats from git log
View git-stats.md

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

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

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
Collect rows by column and group by having count greater than. postgresql sql
View group-by-having.md

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'