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 / 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) {
@goliatone
goliatone / LICENSE
Created Aug 9, 2018 — forked from kirbysayshi/LICENSE
Hierarchical Spatial Hash Grid: extremely efficient spatial hashing for collision detection between objects of any size! This is an implementation in JS as described in http://www10.informatik.uni-erlangen.de/~schornbaum/hierarchical_hash_grids.pdf
View LICENSE
Copyright 2012 Andrew Petersen
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR O
@goliatone
goliatone / gist:19271d6bba18ea49f4c3b7ba83a000df
Created Jul 16, 2018 — forked from cprovatas/gist:6acef442fc43123bcd5d5e937dc7951a
Monitor Mouse Event for any arbitrary application on macOS in Swift
View gist:19271d6bba18ea49f4c3b7ba83a000df
let callback: CGEventTapCallBack = { (tapProxy, eventType, event, refcon) -> Unmanaged<CGEvent>? in
debugPrint("we are monitoring the mouse event here")
return nil
}
let eventMask = (1 << CGEventType.leftMouseDown.rawValue) | (1 << CGEventType.leftMouseUp.rawValue)
let machPort = CGEvent.tapCreateForPid(pid: 40529, place: .tailAppendEventTap, options: .defaultTap, eventsOfInterest: CGEventMask(eventMask), callback: callback, userInfo: nil)!
let runLoopSource = CFMachPortCreateRunLoopSource(kCFAllocatorDefault, machPort, 0)
@goliatone
goliatone / esp8266_pubsubclient.ino
Created Jul 3, 2018 — forked from igrr/esp8266_pubsubclient.ino
PubSubClient sample for ESP8266 Arduino
View esp8266_pubsubclient.ino
#include <PubSubClient.h>
#include <ESP8266WiFi.h>
const char* ssid = ".................";
const char* password = "................";
char* topic = "esp8266_arduino_out";
char* server = "iot.eclipse.org";
@goliatone
goliatone / aggregate.js
Created May 31, 2018 — forked from kdelemme/aggregate.js
Aggregate data from MongoDB with Node.js and mongoose
View aggregate.js
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
//Database connection
var uristring = 'mongodb://localhost/test';
var mongoOptions = { };
mongoose.connect(uristring, mongoOptions, function (err, res) {
if (err) {
console.log('Error when connecting to: ' + uristring + '. ' + err);
You can’t perform that action at this time.