Skip to content

Instantly share code, notes, and snippets.

View emurmotol's full-sized avatar
😎
I may be slow to respond.

emurmotol

😎
I may be slow to respond.
View GitHub Profile
@chadlung
chadlung / main.go
Last active February 13, 2020 22:34
An example Go (golang) REST service that uses JWT (JSON Web Tokens) and Negroni http://www.giantflyingsaucer.com/blog/?p=5994
package main
// Generate RSA signing files via shell (adjust as needed):
//
// $ openssl genrsa -out app.rsa 1024
// $ openssl rsa -in app.rsa -pubout > app.rsa.pub
//
// Code borrowed and modified from the following sources:
// https://www.youtube.com/watch?v=dgJFeqeXVKw
// https://goo.gl/ofVjK4
@miohtama
miohtama / geth-secure.md
Last active January 13, 2022 23:11
Secure RPC connections to geth daemon

Go Ethereum (geth) is a software for Ethereum. geth doesn't provide secure networking and it should do this, as this kind of built-in functionality would increase complexity and add attack surface to critical blockchain node software. Fortunately, in UNIX world, you can easily combine different tools to work together. The solution to this particular problem is to use VPN/tunneling software for secure connections. The tunnel will expose the server local connections to your own computer. The most popular tool for this (available in every OS by default, nowadays including Windows) is [Secure Shell (SSH)][1].

Note this question only addresses issues how to

[If you are not familiar with SSH please first read SSH tutorial how to safely do passwordless logins using SSH keys][2].

Start a node on server. When the node starts it binds its RPC port to localhost (127.0.0.1 in IPv4, ::1 in IPv6). This is so-called loopback connection that you can only access from the computer itself and not from external netwo

Q: How big is the blockchain today?
A: 415'000 blocks, 70 Gigabytes.
Q: Where is the blockchain stored?
A: On all the nodes participating in the Bitcoin p2p network.
Implicit consensus is achieved by all nodes following the same rules (and incentives).
Q: What kind of encryption is Bitcoin using?
A: none (rather hashing and signing).
@dryaf
dryaf / templates.go
Created May 21, 2016 14:51
labstack echo template inheritance recipe
package bla
import (
"io"
"html/template"
"path/filepath"
"strings"
)
// folder structure
/* e-Gizmo RFID kit Arduino Demo */
// defines used by the serial event
// do not modify
#define STX 2
#define ETX 3
#define SERIALSTX 0
#define SERIALETX 1
#define SERIALRDY 2
/*
* Arduino and RDM630 RFID module
* www.KendrickTabi.com
* http://www.kendricktabi.com/2015/04/arduino-and-rdm630-rfid-module.html
*/
#include <SoftwareSerial.h>
SoftwareSerial RDM630 = SoftwareSerial(2,3); // RFID
.
├── books
│   ├── handlers.go
│   └── models.go
├── config
│   └── db.go
└── main.go
@danesparza
danesparza / negroni-gorilla.go
Last active December 16, 2020 12:36
Negroni with Gorilla mux subrouter
package main
import (
"fmt"
"github.com/codegangsta/negroni"
"github.com/gorilla/mux"
"log"
"net/http"
)
@Bochenski
Bochenski / app.go
Created July 9, 2014 14:41
Negroni golang mgo middleware example
package main
import (
"github.com/codegangsta/negroni"
"github.com/gorilla/context"
"github.com/unrolled/render"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"log"
"net/http"
@koomai
koomai / PhpStorm Keyboard Shortcuts.md
Last active September 14, 2024 00:46
Frequently Used PhpStorm Keyboard Shortcuts

Note: Some of these shortcuts have been remapped for my own convenience (Preferences->Keymap). These are Mac shortcuts, just use the Windows/Linux equivalent of the Cmd/Option/Ctrl/Del keys.

####Search, Go to, Navigation ####

Cmd + P - Search file

Cmd + Shift + O - Search everywhere

(I swapped the above two recently because I use Cmd + P to search for files most of the time).