Skip to content

Instantly share code, notes, and snippets.

View cicorias's full-sized avatar

Shawn Cicoria cicorias

View GitHub Profile
@cicorias
cicorias / settings.json
Created March 10, 2021 20:43
Settings file for Windows Terminal
// This file was initially generated by Windows Terminal 1.4.3243.0
// It should still be usable in newer versions, but newer versions might have additional
// settings, help text, or changes that you will not see unless you clear this file
// and let us generate a new one for you.
// To view the default settings, hold "alt" while clicking on the "Settings" button.
// For documentation on these settings, see: https://aka.ms/terminal-documentation
{
"$schema": "https://aka.ms/terminal-profiles-schema",
@cicorias
cicorias / az-function-set-event-grid-key.sh
Created March 10, 2021 14:40
retrieving event grid key and topic stuff
#!/usr/bin/env bash
set -euxo pipefail
EG_ID=$1
KEY="key1"
endpoint=$(az eventgrid topic show --ids $EG_ID --query endpoint | sed -e 's/^"//' -e 's/"$//')
eg_name=$(az eventgrid topic show --ids $EG_ID --query name | sed -e 's/^"//' -e 's/"$//')
eg_group=$(az eventgrid topic show --ids $EG_ID --query resourceGroup | sed -e 's/^"//' -e 's/"$//')
@cicorias
cicorias / guid.js
Created February 24, 2021 20:45
generate a guid pure javascript
let uniqueId = Date.now().toString(36) + Math.random().toString(36).substring(2);
const guid=()=> {
const s4=()=> Math.floor((1 + Math.random()) * 0x10000).toString(16).substring(1);
return `${s4() + s4()}-${s4()}-${s4()}-${s4()}-${s4() + s4() + s4()}`;
}
function generateGuid() {
var result, i, j;
@cicorias
cicorias / nodeJs.crypto.calculatingHash.js
Created January 5, 2021 18:02 — forked from GuillermoPena/nodeJs.crypto.calculatingHash.js
NodeJS - CRYPTO : How to calculate a hash from file or string
var crypto = require('crypto')
, fs = require('fs')
// Algorithm depends on availability of OpenSSL on platform
// Another algorithms: 'sha1', 'md5', 'sha256', 'sha512' ...
var algorithm = 'sha1'
, shasum = crypto.createHash(algorithm)
// Updating shasum with file content
var filename = __dirname + "/anything.txt"
@cicorias
cicorias / pytorch-bit.ipynb
Created December 19, 2020 21:20
PyTorch BiT
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@cicorias
cicorias / spider.sh
Created November 23, 2020 12:51 — forked from azhawkes/spider.sh
Really simple wget spider to obtain a list of URLs on a website, by crawling n levels deep from a starting page.
#!/bin/bash
HOME="http://www.yourdomain.com/some/page"
DOMAINS="yourdomain.com"
DEPTH=2
OUTPUT="./urls.csv"
wget -r --spider --delete-after --force-html -D "$DOMAINS" -l $DEPTH "$HOME" 2>&1 \
| grep '^--' | awk '{ print $3 }' | grep -v '\. \(css\|js\|png\|gif\|jpg\)$' | sort | uniq > $OUTPUT
@cicorias
cicorias / ssh.sh
Created November 15, 2020 03:33 — forked from zircote/ssh.sh
Convert a AWS PEM into a ssh pub key
ssh-keygen -y -f private_key1.pem > public_key1.pub
@cicorias
cicorias / shapshit.sh
Created November 9, 2020 23:54
Shap shit
from keras.applications.vgg16 import VGG16
from keras.applications.vgg16 import preprocess_input
import keras.backend as K
import numpy as np
import json
import shap
# load pre-trained model and choose two images to explain
model = VGG16(weights='imagenet', include_top=True)
X,y = shap.datasets.imagenet50()
@cicorias
cicorias / addIssues.sh
Created November 5, 2020 03:04
create GitHub issues from the command line with a file
#!/usr/bin/env bash
filename='reqs.txt'
echo Start
while read p; do
title=$(echo "$p" | cut -d, -f1)
body=$(echo "$p" | cut -d, -f2)
gh issue create --title "$title" --body "$body" --label "enhancement"
done < $filename
@cicorias
cicorias / progress.java
Created October 11, 2020 13:26
java progress bar system console
public static void progressPercentage(int remain, int total) {
if (remain > total) {
throw new IllegalArgumentException();
}
int maxBareSize = 10; // 10unit for 100%
int remainProcent = ((100 * remain) / total) / maxBareSize;
char defaultChar = '-';
String icon = "*";
String bare = new String(new char[maxBareSize]).replace('\0', defaultChar) + "]";
StringBuilder bareDone = new StringBuilder();