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 / 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() {
@goliatone
goliatone / mh-z14.ino
Created Jan 26, 2019 — forked from igrr/mh-z14.ino
MH-Z14 ESP8266 Arduino example
View mh-z14.ino
#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
#include <ESP8266mDNS.h>
#include <time.h>
const char* ssid = "co2_sensor";
const char* password = "1qazxsw2";
ESP8266WebServer server(80);
@goliatone
goliatone / Makefile
Created Dec 2, 2018 — forked from TheHippo/Makefile
Golang Makefile example
View Makefile
OUT := binariy-name
PKG := gitlab.com/group/project
VERSION := $(shell git describe --always --long --dirty)
PKG_LIST := $(shell go list ${PKG}/... | grep -v /vendor/)
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/)
all: run
server:
go build -i -v -o ${OUT} -ldflags="-X main.version=${VERSION}" ${PKG}
@goliatone
goliatone / Router.swift
Created Sep 17, 2018 — forked from zmeyc/Router.swift
Router pattern in Swift
View Router.swift
// Playing with router pattern in Swift. Paste to a playground.
//
// This code is in public domain, feel free to copy/paste.
import Cocoa
extension NSScanner {
func scanUpToString(string: String) -> String? {
var result: NSString? = nil
if scanUpToString(string, intoString: &result) {
You can’t perform that action at this time.