Skip to content

Instantly share code, notes, and snippets.

View ccondry's full-sized avatar

Coty Condry ccondry

  • Cisco Systems
  • Texas
View GitHub Profile
@ccondry
ccondry / amiibos.txt
Created April 15, 2020 21:42
amiibo NFC list
001 - Isabelle
002 - Tom Nook
003 - DJ KK
004 - Sable
005 - Kappn
006 - Resetti
007 - Joan
008 - Timmy
009 - Digby
010 - Pascal
@ccondry
ccondry / sd-zero.sh
Created October 20, 2022 16:24
fix SD card format
sudo dd if=/dev/zero of=/dev/disk3 bs=1024 count=100
@ccondry
ccondry / get-public-ip.sh
Created January 23, 2020 19:08
get public IP
#!/bin/sh
dig +short myip.opendns.com @resolver1.opendns.com
# or use the following:
# dig TXT +short o-o.myaddr.l.google.com @ns1.google.com
@ccondry
ccondry / genkey.sh
Created October 21, 2020 15:33
generate SSH RSA key
ssh-keygen -t rsa -b 4096 -C "your_email@example.com"
@ccondry
ccondry / webex-room.html
Created April 14, 2021 05:06
open webex teams room from web link
<a href="webexteams://im?space=abcd-1234-efgh-56789">
@ccondry
ccondry / docker-rm.sh
Created March 28, 2021 09:30
remove all docker images
docker rm $(docker ps -a -q)
docker rmi $(docker images -q)
docker volume rm $(docker volume ls |awk '{print $2}')
rm -rf ~/Library/Containers/com.docker.docker/Data/*
@ccondry
ccondry / random-int.js
Last active March 4, 2021 17:21
choose random integer between min and max, inclusively
function randomInt (min, max) {
const range = max - min
if (range < 0) {
throw Error('cannot generate random int with min-max range less than 0')
}
const r = Math.random()
return Math.round(r * range + min)
}
@ccondry
ccondry / send-webex-file.js
Created February 22, 2021 21:49
send data as a file to webex user or room using node-fetch
require('dotenv').config()
const fetch = require('node-fetch')
async function sendWebexFile ({
filename = 'test.csv',
fileMetaName = 'files',
contentType = 'text/csv',
content,
metadata = {}
}) {
@ccondry
ccondry / submit.md
Created February 22, 2021 21:33 — forked from tanaikech/submit.md
Multipart-POST Request Using Node.js

Multipart-POST Request Using Node.js

Here, I introduce 2 scripts for uploading files to Slack using Node.js as samples. These 2 sample scripts are for uploading files to Slack.

Sample script 1:

  • You can upload the zip file by converting byte array as follows.
    • At first, it builds form-data.
    • Adds the zip file converted to byte array and boundary using Buffer.concat().
    • This is used as body in request.
@ccondry
ccondry / short-hash.js
Created February 20, 2021 14:43
create a short alphanumeric hash using shake128
const crypto = require('crypto')
// create hash of user sub, and append it to the first 8 characters of the user sub
function getHash (sub) {
const hash = crypto
.createHash('shake128', {outputLength: 6})
.update(sub, 'utf-8')
.digest('base64')
// you could remove this replace statement if you didn't want to alter the base64 or number of output characters
// this is here so that only alphanumerics are returned. but it does change the length of some hashes (consistently)