Skip to content

Instantly share code, notes, and snippets.

@goliatone
goliatone / simple-gpg-enc.go
Created August 16, 2020 07:42 — forked from stuart-warren/simple-gpg-enc.go
golang gpg/openpgp encryption/decryption example
package main
import (
"bytes"
"code.google.com/p/go.crypto/openpgp"
"encoding/base64"
"io/ioutil"
"log"
"os"
)
@goliatone
goliatone / gpg-encrypt.go
Created August 16, 2020 07:42 — forked from ayubmalik/gpg-encrypt.go
Golang encrypt file using GPG openpgp. Use standard go libs.
package main
/**
Example hack to encrypt a file using a GPG encryption key. Works with GPG v2.x.
The encrypted file e.g. /tmp/data.txt.gpg can then be decrypted using the standard command
gpg /tmp/data.txt.gpg
Assumes you have **created** an encryption key and exported armored version.
You have to read the armored key directly as Go cannot read pubring.kbx (yet).
@goliatone
goliatone / download_multiple.py
Created May 19, 2020 05:07 — forked from Hammer2900/download_multiple.py
Use asyncio and aiohttp to asynchronously download multiple files at once and handle the responses as they finish
import asyncio
from contextlib import closing
import aiohttp
async def download_file(session: aiohttp.ClientSession, url: str):
async with session.get(url) as response:
assert response.status == 200
# For large files use response.content.read(chunk_size) instead.
'use strict';
/**
* This plugin add hot command reload by watching
* file changes on any file under `./commands` and
* issuing a `reloadCommand` to the context.
* This
*/
module.exports.init = function(context, config) {
if (process.env.NODE_ENV !== 'development') return {};
@goliatone
goliatone / README.md
Last active February 1, 2025 14:55 — forked from colophonemes/create_triggers
Postgres TRIGGER to call NOTIFY with a JSON payload

This TRIGGER function calls PosgreSQL's NOTIFY command with a JSON payload. You can listen for these calls and then send the JSON payload to a message queue (like AMQP/RabbitMQ) or trigger other actions.

Create the trigger with notify_trigger.sql.

When declaring the trigger, supply the column names you want the JSON payload to contain as arguments to the function (see create_triggers.sql)

The payload returns a JSON object:

@goliatone
goliatone / .block
Created September 24, 2019 04:03 — forked from rveciana/.block
RxJS and svelte
licence: mit
@goliatone
goliatone / README.md
Last active April 4, 2023 02:10 — forked from princejwesley/await-babel-repl.js
[Node REPL] Examples of node REPL #repl #nodejs #node

Node.js REPL Examples

Different examples of Node.js REPLs

  • Top level async/await
  • Using custom VM
  • Using atocomplete, custom commands, histroy, etc
@goliatone
goliatone / aes256-gcm.go
Created June 29, 2019 17:56 — forked from kkirsche/aes256-gcm.go
AES-256 GCM Encryption Example in Golang
package example_test
import (
"crypto/aes"
"crypto/cipher"
"hex"
"io"
)
// AES-GCM should be used because the operation is an authenticated encryption
@goliatone
goliatone / aes-256-gcm.go
Last active June 29, 2019 17:56 — forked from cannium/aes-256-gcm.go
golang aes-256-gcm
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/hex"
"fmt"
"io"
)
#meta-data:
instance-id: hostname
network-interfaces: |
auto eth0
iface eth0 inet static
address 192.168.1.34
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.254