Skip to content

Instantly share code, notes, and snippets.

goliatone

Block or report user

Report or block goliatone

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@goliatone
goliatone / README.md
Last active Oct 12, 2019 — forked from colophonemes/create_triggers
Postgres TRIGGER to call NOTIFY with a JSON payload
View README.md

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 Sep 24, 2019 — forked from rveciana/.block
RxJS and svelte
View .block
licence: mit
@goliatone
goliatone / await-babel-repl.js
Created Sep 19, 2019 — forked from princejwesley/await-babel-repl.js
REPL with standalone await + babel transform
View await-babel-repl.js
const repl = require('repl');
const babel = require('babel-core');
function preprocess(input) {
const awaitMatcher = /^(?:\s*(?:(?:let|var|const)\s)?\s*([^=]+)=\s*|^\s*)(await\s[\s\S]*)/;
const asyncWrapper = (code, binder) => {
let assign = binder ? `global.${binder} = ` : '';
return `(function(){ async function _wrap() { return ${assign}${code} } return _wrap();})()`;
};
@goliatone
goliatone / aes256-gcm.go
Created Jun 29, 2019 — forked from kkirsche/aes256-gcm.go
AES-256 GCM Encryption Example in Golang
View aes256-gcm.go
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 Jun 29, 2019 — forked from cannium/aes-256-gcm.go
golang aes-256-gcm
View aes-256-gcm.go
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/hex"
"fmt"
"io"
)
View cloud-init non-cloud static IP.txt
#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 Jun 10, 2019 — forked from tinti/aes-256-gcm.go
[golang aes-256-gcm] Example script using AES-256 in golang #go #crypto
View aes-256-gcm.go
package main
import (
"crypto/aes"
"crypto/cipher"
"crypto/rand"
"encoding/hex"
"flag"
"fmt"
"io"
@goliatone
goliatone / mysql-docker.sh
Created Apr 24, 2019 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
View mysql-docker.sh
# 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
@goliatone
goliatone / client.go
Created Apr 16, 2019 — forked from Merovius/client.go
Dbus minimal example in go, rudimentary implementation of http://www.galago-project.org/specs/notification/0.9/
View client.go
package main
import (
"github.com/guelfey/go.dbus"
)
func main() {
conn, err := dbus.SessionBus()
if err != nil {
panic(err)
@goliatone
goliatone / avahi.go
Created Mar 26, 2019 — forked from lemenkov/avahi.go
How to register service with Avahi using golang and dbus
View avahi.go
package main
import (
"github.com/guelfey/go.dbus"
"log"
"bufio"
"os"
)
func main() {
You can’t perform that action at this time.