Skip to content

Instantly share code, notes, and snippets.

View joekiller's full-sized avatar

Joseph Lawson joekiller

View GitHub Profile
@piroor
piroor / aes-gcm-encryption.js
Last active August 16, 2022 08:02
Example of AES-GCM encryptor with passphrase, based on Web Crypto API
async function getKey(passphrase, salt = null) {
passphrase = (new TextEncoder()).encode(passphrase);
let digest = await crypto.subtle.digest({ name: 'SHA-256' }, passphrase);
let keyMaterial = await crypto.subtle.importKey(
'raw',
digest,
{ name: 'PBKDF2' },
false,
['deriveKey']
);
@avishayil
avishayil / route53.sh
Created October 14, 2018 17:00
Update Route53 Record With Machine IP Address
#!/bin/bash
# (optional) You might need to set your PATH variable at the top here
# depending on how you run this script
# PATH=PATH
# Hosted Zone ID e.g. BJBK35SKMM9OE
ZONEID="ZONEID"
# The CNAME you want to update e.g. hello.example.com
@BoGnY
BoGnY / README.md
Last active May 7, 2024 07:02
[WINDOWS] How to enable auto-signing Git commits with GnuPG for programs that don't support it natively

[WINDOWS] How to enable auto-signing Git commits with GnuPG for programs that don't support it natively

This is a step-by-step guide on how to enable auto-signing Git commits with GPG for every applications that don't support it natively (eg. GitHub Desktop, Eclipse, Git Tower, ...)

Requirements

  • Install GPG4Win: this software is a bundle with latest version of GnuPG v2, Kleopatra v3 certificate manager, GNU Privacy Assistant (GPA) v0.9 which is a GUI that uses GTK+, GpgOL and GpgEX that are respectively an extension for MS Outlook and an extension for Windows Explorer shell
  • Install Git for Windows: so you can have a *nix based shell, this software is a bundle with latest version of Git which use MINGW environment, a Git bash shell, a Git GUI and an extension for Windows Explorer shell (Make sure your local version of Git is at least 2.0, otherwise Git don't have support for automatically sign your commits)
  • Verify
@TheDeveloper
TheDeveloper / aws-cluster-stack.yml
Last active February 28, 2024 12:00
Stack to create EC2 instances for ECS cluster.
# Stack to create EC2 instances for ECS cluster.
#
# aws cloudformation deploy \
# --stack-name app-cluster-prod \
# --template-file ./aws-cluster-stack.yaml \
# --parameter-overrides \
# KeyName=DEFAULT \
# SecurityGroups=group1,group2 \
# ImageId=ami-123456 \
# InstanceType=c5.large \
@qbein
qbein / netcat
Created July 11, 2015 10:01
Replay pcap/pcapng TCP traffic using netcat
For development it may be useful to be able to replay TCP traffic (e.g. HTTP). The dump can be created using WireShark or tcpdump:
$ tcpdump -s 0 port http -i en0 -w dump.pcap
To generate data files that can be replayed through netcat we use tcptrace:
$ tcptrace -e input.pcapng
Finally replay the HTTP traffic using netcat to host 192.168.1.1 port 80
$ cat a2b_contents.dat | nc -v 192.168.1.1 80
If you need to replay the raw network traffic, we need to do some massaging using tcpprep and tcprewrite before using tcpreplay to replay the raw packages. Note that due to limitation of tcprewrite this will not replay any traffic to the network: http://tcpreplay.synfin.net/wiki/FAQ#Doestcpreplaysupportsendingtraffictoaserver.
@AgentO3
AgentO3 / ops.coffee
Last active April 29, 2019 06:58
Hubot Ansible Script and Ansible Ops Playbooks
# Description:
# An attempt to expose Ansible commands through hubot
#
# Dependencies:
# "underscore": "~1.5.2"
# "js-yaml": "^3.2.7"
#
#
# Configuration:
# None
@karanth
karanth / jetty-clojure.md
Last active December 20, 2023 19:15
Notes on installing SSL certificates in jetty - clojure + ring

SSL is an important security and privacy feature for all websites. Its details are outlined in this wikipedia [article] ("http://en.wikipedia.org/wiki/Secure_Sockets_Layer"). At Scibler, we use SSL certificates, encrypting all traffic to and fro from our servers. SSL is a public-key based asymmetric encryption scheme for symmetric key exchange. Symmetric keys are used for payload encryption. On our servers, we use embedded jetty (ring jetty adapter), with the clojure [ring] (https://github.com/ring-clojure) library to handle the http specific functionality.

This is a tutorial about installing SSL certificates on jetty webservers. SSL certificates are X.509 certificates that can be self-signed (authorized by Scibler) or can be signed by trusted third-parties. Trusted third-party certificates are the ones that a Internet user and browsers trust the most. Trusted third-party certification authorities issue certificates per domain and charge a nominal yearly fee.

####Pre-Requisites

  • The Java JDK has to be
grunt jshint:ci --no-color
grunt test:ci --no-color
grunt build:app --no-color
grunt build:vendor --no-color
grunt build:html --tag=<tag-goes-here> --loc=<base-url-goes-here> --no-color
grunt build:css --tag=<tag-goes-here> --no-color
grunt uglify:app --no-color
grunt cssmin:ci --no-color
grunt copy:ci --no-color
@dropwhile
dropwhile / .netrc
Last active February 22, 2024 16:22
example netrc
# .netrc
## generate token with https://help.github.com/articles/creating-an-oauth-token-for-command-line-use
machine github.com login <token>