Skip to content

Instantly share code, notes, and snippets.

@stigok
stigok / githook.js
Last active July 30, 2023 09:46
Verify GitHub webhook signature header in Node.js
/*
* Verify GitHub webhook signature header in Node.js
* Written by stigok and others (see gist link for contributor comments)
* https://gist.github.com/stigok/57d075c1cf2a609cb758898c0b202428
* Licensed CC0 1.0 Universal
*/
const crypto = require('crypto')
const express = require('express')
const bodyParser = require('body-parser')
<!DOCTYPE html>
<html>
<head>
<style>
#map {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
position: absolute;
#!/usr/bin/env python2
import json
import random
import copy
import googlemaps
import math
import os.path
import datetime
def distanceFromLarAndLon(lon1, lat1, lon2, lat2):
@leonardofed
leonardofed / README.md
Last active April 24, 2024 01:47
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


FROM python:2.7-alpine
MAINTAINER Nick Janetakis <nick.janetakis@gmail.com>
ENV INSTALL_PATH /bsawf
RUN mkdir -p $INSTALL_PATH
WORKDIR $INSTALL_PATH
COPY requirements.txt requirements.txt
RUN apk add --no-cache --virtual .build-deps \
@bmhatfield
bmhatfield / .profile
Last active March 18, 2024 07:43
Automatic Git commit signing with GPG on OSX
# In order for gpg to find gpg-agent, gpg-agent must be running, and there must be an env
# variable pointing GPG to the gpg-agent socket. This little script, which must be sourced
# in your shell's init script (ie, .bash_profile, .zshrc, whatever), will either start
# gpg-agent or set up the GPG_AGENT_INFO variable if it's already running.
# Add the following to your shell init to set up gpg-agent automatically for every shell
if [ -f ~/.gnupg/.gpg-agent-info ] && [ -n "$(pgrep gpg-agent)" ]; then
source ~/.gnupg/.gpg-agent-info
export GPG_AGENT_INFO
else
@lenaten
lenaten / gist:96f7102c92b3a7d59a50
Last active December 6, 2017 10:59
Hosting React app in s3 with CloudFront
- create s3 bucket, for example: react.
- create cloudfront distributions with these settings:
- Default Root Object: index.html
- Origin Domain Name: s3 bucket url, for example: react.s3.amazonaws.com
- add custom error page with these settings:
- HTTP Error Code: 403: Forbidden
- Customize Error Response: Yes
- Response Page Path: /index.html
- HTTP Response Code: 200: OK
@jice-lavocat
jice-lavocat / imageSyncing.js
Last active May 6, 2022 05:18
AWS Lambda - S3 : Thumbnail creation
// dependencies
var async = require('async');
var path = require('path');
var AWS = require('aws-sdk');
var gm = require('gm').subClass({
imageMagick: true
});
var util = require('util');
// get reference to S3 client
var s3 = new AWS.S3();
@telekosmos
telekosmos / uniq.js
Last active November 15, 2022 17:13
Remove duplicates from js array (ES5/ES6)
var uniqueArray = function(arrArg) {
return arrArg.filter(function(elem, pos,arr) {
return arr.indexOf(elem) == pos;
});
};
var uniqEs6 = (arrArg) => {
return arrArg.filter((elem, pos, arr) => {
return arr.indexOf(elem) == pos;
});
@crazygit
crazygit / save_docker_images
Last active April 6, 2016 13:14
Save all docker images to tar files for copy to another machine
#!/usr/bin/env bash
####################################################################
# Usage:
# Save all docker images to tar files for copy to another machine
####################################################################
images=$(docker images | awk 'NR>1 && $1 != "<none>" {printf("%s:%s\n", $1, $2)}')
for image in $images
do