Skip to content

Instantly share code, notes, and snippets.

@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 May 12, 2024 02:52 — 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
@goliatone
goliatone / aes-256-gcm.go
Last active September 2, 2021 00:52 — forked from tinti/aes-256-gcm.go
[golang aes-256-gcm] Example script using AES-256 in golang #go #crypto
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/hex"
"flag"
"fmt"
"io"
@goliatone
goliatone / mysql-docker.sh
Created April 24, 2019 22:47 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE