Skip to content

Instantly share code, notes, and snippets.

View andyinabox's full-sized avatar

Andy Dayton andyinabox

View GitHub Profile
@redgeoff
redgeoff / create-cluster.sh
Created September 22, 2018 20:45
Create CouchDB Cluster
#!/bin/bash
# Usage: create-cluster.sh user password port local-port space-separated-ips
user=$1
password=$2
port=$3
localPort=$4
ips=$5
@jniltinho
jniltinho / golang-sending-email.go
Last active February 4, 2024 16:57
Postfix and Golang - Sending emails
package main
import (
"fmt"
"net/mail"
"net/smtp"
"strings"
)
var host = "127.0.0.1"
@sveggiani
sveggiani / instructions.md
Last active July 15, 2023 21:52
[Configure XDebug, Visual Studio Code for a Vagrant VM] #debug #vm #vscode #masscode

Configure XDebug, Visual Studio Code for a Vagrant VM

1. Assumptions

  • Project (Drupal) is served on /var/www/html in the Vagrant box
  • Local project files location: c:\Users\username\Work\projects\my-project\repo\html
  • Guest machine IP is 10.0.2.2 (if this doesn't work, run route -nee in the VM and look for the gateway address)

2. Configuration

@vdparikh
vdparikh / main.go
Created November 9, 2017 19:06
GoLang Verify/Generate JWT Token
package main
import (
"encoding/json"
"fmt"
"log"
"net/http"
"strings"
"time"
@mrw34
mrw34 / postgres.sh
Last active March 26, 2024 00:24
Enabling SSL for PostgreSQL in Docker
#!/bin/bash
set -euo pipefail
openssl req -new -text -passout pass:abcd -subj /CN=localhost -out server.req -keyout privkey.pem
openssl rsa -in privkey.pem -passin pass:abcd -out server.key
openssl req -x509 -in server.req -text -key server.key -out server.crt
chmod 600 server.key
test $(uname -s) = Linux && chown 70 server.key
docker run -d --name postgres -e POSTGRES_HOST_AUTH_METHOD=trust -v "$(pwd)/server.crt:/var/lib/postgresql/server.crt:ro" -v "$(pwd)/server.key:/var/lib/postgresql/server.key:ro" postgres:12-alpine -c ssl=on -c ssl_cert_file=/var/lib/postgresql/server.crt -c ssl_key_file=/var/lib/postgresql/server.key
@kafkahw
kafkahw / mock_api_webpack
Created January 19, 2017 20:58
Mock API with webpack
https://webpack.github.io/docs/webpack-dev-server.html#api
If mocking API is needed when running webpack dev server, you can set it up in your webpack config as follows:
devServer: {
setup: function(app) {
// Here you can access the Express app object and add your own custom middleware to it.
// For example, to define custom handlers for some paths:
// app.get('/some/path', function(req, res) {
// res.json({ custom: 'response' });
// });
},

Candace's Crypto-training Docs

Notes from trainings giving at Eybeam (12/3/16), Free School/Escuelita Libre (1/14/17), Art is Labor (4/23/2017), and BUFU's digital security skillshare (7/11/2017)

Secure Communnications

SMS and Messaging

@tushar-borole
tushar-borole / traverse.js
Last active May 16, 2023 17:37 — forked from steinfletcher/traverse.js
Object tree traversal in javascript (with lodash)
var data = {
"name": "root",
"contents": [
{
"name": "A",
"contents": [
{
"name": "fileA1",
"contents": []
}
@cdevroe
cdevroe / gist:4fb3ebf7806b39020c33
Created May 28, 2015 14:17
Open Visual Studio Code from Terminal
code () {
if [[ $# = 0 ]]
then
open -a "Visual Studio Code" -n
else
[[ $1 = /* ]] && F="$1" || F="$PWD/${1#./}"
open -a "Visual Studio Code" -n --args "$F"
fi
}
@jvcleave
jvcleave / ! Install Instructions
Last active April 22, 2016 21:11
MAC WITH DEBIAN VM CROSS COMPILER FOR RPI
ON THE RPI (if you haven't downloaded openFrameworks)
$ cd
$ curl -O http://www.openframeworks.cc/versions/v0.8.4/of_v0.8.4_linuxarmv6l_release.tar.gz
$ mkdir openFrameworks
$ tar vxfz of_v0.8.4_linuxarmv6l_release.tar.gz -C openFrameworks --strip-components 1
$ cd /home/pi/openFrameworks/scripts/linux/debian_armv6l
$ sudo ./install_dependencies.sh
ON THE MAC: