Skip to content

Instantly share code, notes, and snippets.

View rms1000watt's full-sized avatar

Ryan M Smith rms1000watt

View GitHub Profile
@rms1000watt
rms1000watt / pause-and-resume-process.sh
Created July 12, 2023 00:00
Pause & Resume a Process
kill -STOP "${PID}"
kill -CONT "${PID}"
@rms1000watt
rms1000watt / python-extract-after-scrape.py
Created July 13, 2016 15:31
Python script to extract phone numbers and emails from html pages that were web scraped
import re
import glob
def main():
outputFile = 'output.tsv'
files = glob.glob('*.html')
print "Extracting from %s files" %(len(files))
data = []
@rms1000watt
rms1000watt / main.py
Created December 14, 2018 18:19
github webhook secret hash hmac sha1 digest compare python lambda function through AWS API Gateway
import hmac
import hashlib
def equal_hash(event):
secret_value = "secret-value-put-in-github-webhook-ui"
sigExpected = str(event["headers"]["X-Hub-Signature"].replace("sha1=", ""))
sigCalculated = str(hmac.new(secret_value, event["body"], hashlib.sha1).hexdigest())
return hmac.compare_digest(sigCalculated, sigExpected)
@rms1000watt
rms1000watt / benchmark.js
Created March 29, 2023 16:45
benchmark in nodejs
const Benchmark = require('benchmark');
suite
.add('test1', function() {
console.log('stuff');
})
.add('test2', function() {
console.log('stuff');
})
.on('cycle', function(event) {
@rms1000watt
rms1000watt / golang-errors-stack-line.go
Last active March 26, 2023 05:28
Golang Errors Stacktrace and Line Number
// https://godoc.org/github.com/pkg/errors#Frame.Format
package main
import (
"fmt"
"github.com/pkg/errors"
)
@rms1000watt
rms1000watt / python-polynomial-fit.py
Created September 6, 2016 21:32
Python script for polynomial fitting curve
import numpy as np
import matplotlib.pyplot as plt
t = np.linspace(0,30,100)
y = np.random.random(100)
# Note: polynomialOrder too large will yeild warning: RankWarning: Polyfit may be poorly conditioned
# Note: depends on the signal you're fitting. A sine wave has no problem with order = 200
# Note: but this random data doesn't fit right with order > 18 (you can see it by eye)
polynomialOrder = 10
@rms1000watt
rms1000watt / Readme.md
Last active November 19, 2022 18:38
Github Actions --> AWS OIDC in Terraform
@rms1000watt
rms1000watt / exec-command-stdout-pipe.go
Last active October 22, 2022 12:33
Execute Command with stdout Pipe in Golang
package main
import (
"bufio"
"fmt"
"os/exec"
"errors"
"strings"
log "github.com/sirupsen/logrus"
@rms1000watt
rms1000watt / openssl-full-chain-trust-website.sh
Last active September 19, 2022 00:31
Openssl get full chain of trust from website
# The first one in that file is the actual cert of the website
# The following ones in that file is the chain. Possibly this should separate full-chain.pem to chain.pem + cert.pem
openssl s_client -host www.google.com -port 443 -showcerts 2>&1 | sed -n '/BEGIN CERTIFICATE/,/END CERTIFICATE/p' > ~/Desktop/full-chain.pem
@rms1000watt
rms1000watt / .README
Last active August 31, 2022 16:56
New Computer Install
THIS GIST IS DEPRECATED. USE THIS INSTEAD:
https://github.com/rms1000watt/new-computer