Skip to content

Instantly share code, notes, and snippets.

@markeissler
markeissler / index.js
Created November 25, 2021 22:20 — forked from marcusgadbem/index.js
Middleware to minify HTML output for express template render engines in which supports callbacks
/* app/controllers/index.js */
module.exports.index = function(req, res) {
res.render('index.html');
};
@markeissler
markeissler / downloadFile.js
Created August 11, 2020 23:38 — forked from dreamyguy/downloadFile.js
Download response.data as a file, through Blob()
// 'downloadFile.js', written by blending two solutions:
// 'js-download' https://github.com/kennethjiang/js-file-download
// 'Anders Paulsen' https://blog.jayway.com/2017/07/13/open-pdf-downloaded-api-javascript/
export function downloadFile(data, filename, mime) {
// It is necessary to create a new blob object with mime-type explicitly set
// otherwise only Chrome works like it should
const blob = new Blob([data], {type: mime || 'application/octet-stream'});
if (typeof window.navigator.msSaveBlob !== 'undefined') {
// IE doesn't allow using a blob object directly as link href.
@markeissler
markeissler / md5-example.go
Created April 21, 2020 16:08 — forked from sergiotapia/md5-example.go
Golang - How to hash a string using MD5.
import (
"crypto/md5"
"encoding/hex"
)
func GetMD5Hash(text string) string {
hasher := md5.New()
hasher.Write([]byte(text))
return hex.EncodeToString(hasher.Sum(nil))
}
@markeissler
markeissler / mux_handlers.go
Created April 17, 2020 17:04 — forked from bennAH/mux_handlers.go
gorilla mux - multiple handlers
package main
import (
"fmt"
"github.com/gorilla/mux"
"net/http"
)
func main() {
r := mux.NewRouter()
kubectl get pods | grep Evicted | awk '{print $1}' | xargs kubectl delete pod
@markeissler
markeissler / terraform-kubernetes-docker-macos.md
Created February 25, 2019 16:15 — forked from ivaravko/terraform-kubernetes-docker-macos.md
The simple Terraform and Kubernetes with Docker on macOS

If you'd like to experiment with Terraform and Kubernetes on macOS locally, a great provider for doing so is the Kubernetes provider. You can get set up in a few simple steps, like so:

1. Install Docker

Install Docker for Mac if you have not already.

@markeissler
markeissler / iam-s3-policy.json
Created January 8, 2019 00:50 — forked from lusis/iam-s3-policy.json
A sample AWS IAM json policy file with read-only access to certain S3 buckets
{
"Statement":[{
"Effect":"Allow",
"Action":["s3:ListBucket","s3:GetObject","s3:GetObjectVersion"],
"Resource":["arn:aws:s3:::my_bucket/*","arn:aws:s3:::my_bucket"]
}
],
"Statement":[{
"Effect":"Allow",
"Action":["s3:ListBucket","s3:GetObject","s3:GetObjectVersion"],
@markeissler
markeissler / S3-readonly-bucket.json
Created January 8, 2019 00:50 — forked from patrickbrandt/S3-readonly-bucket.json
IAM Policy for read-only S3 bucket access
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "AllowUserToSeeBucketListInTheConsole",
"Action": [
"s3:ListAllMyBuckets",
"s3:GetBucketLocation"
],
"Effect": "Allow",
@markeissler
markeissler / LTUninstall_General.sh
Created September 19, 2018 16:45 — forked from sowderca/LTUninstall_General.sh
Labtech Uninstall Scripts
#!/bin/sh
echo
echo "Uninstalling LabTech."
# If the agent is up, kill it
ps -ef | grep LTAgentMonitor | grep -v grep | awk '{print $2}' | xargs kill 2>/dev/null
ps -ef | grep LTLinuxAgent | grep -v grep | awk '{print $2}' | xargs kill 2>/dev/null
ps -ef | grep LTSystray | grep -v grep | awk '{print $2}' | xargs kill 2>/dev/null
@markeissler
markeissler / raven-shell
Created June 22, 2018 23:05 — forked from barroco/raven-shell
Send Sentry error from shell using curl
#!/bin/sh
SENTRY_KEY=
SENTRY_SECRET=
SENTRY_PROJECTID=1
SENTRY_HOST=sentry.example.com
SCRIPT_ARGUMENTS=$@
capture_error()
{