Skip to content

Instantly share code, notes, and snippets.

View eikaas's full-sized avatar

Robin Eikaas eikaas

View GitHub Profile
package main
import "os"
import "io"
import "encoding/json"
type MyWriters struct {
StandardOutput io.Writer
StandardError io.Writer
FileOutput io.Writer
@eikaas
eikaas / SpaceEngineers-Refinery.cs
Created May 13, 2015 10:58
Space Engineers - Refinery Status
void PrintList(IMyTextPanel panel, List<string> list) {
string str = "";
for (int i = 0; i < list.Count; i++) {
str = str + list[i];
}
panel.WritePublicText(str);
panel.ShowPublicTextOnScreen();
}
@eikaas
eikaas / iptables-nat
Created May 13, 2015 12:50
Iptables NAT
# Linux IPTables NAT Setup
It is important to ensure that the test-server has the proper routes. Else it will
receive the request, but be unable to respond. Thinking that the test-server works and
has proper routes when it in fact doesnt can lead to a world of troubles.
It can be beneficial to just disable the main iterface.
Test to make sure you can reach the internet from the internal test-machine
before trying to map a listening port to it.
@eikaas
eikaas / particle
Created June 23, 2015 08:22
Particle Count
package main
import "fmt"
type Particle struct {
x int
y int
}
type ParticleEmitter struct {
@eikaas
eikaas / particle
Created June 23, 2015 08:24
Particle Count #2
package main
import "fmt"
type Particle struct {
x int
y int
}
type ParticleEmitter struct {
@eikaas
eikaas / gui-crash-on-resize
Created July 3, 2015 07:33
gui-crash-on-resize
package main
import "github.com/andlabs/ui"
import "log"
import "reflect"
func main() {
go ui.Do(initGUI)
err := ui.Go()
@eikaas
eikaas / webserver.go
Created September 10, 2015 22:17
Simple webserver in golang
package main
// Simple webserver i golang
// Importere libraries og stuff
import "fmt"
import "net/http"
import "github.com/gorilla/mux"
// Main entry point i programmet.
@eikaas
eikaas / gist:303078dfa82d0c6c20b1
Created September 29, 2015 13:55
Archlinux Full Disk Encryption
##########################################################
# #
# Installing Archlinux with Full Disk Encryption and LVM #
# #
##########################################################
# For the perfect setup, your disk should be overwritten by random data. Encrypted data should be indistinguishable from encrypted data.
# That way an adversary would not be able to determine where the encrypted portion starts.
# WARNING: This is an extremely taxing operation. This can take A DAY OR MORE TO COMPLETE. Not for the impatient.
dd if=/dev/urandom of=/dev/sda
@eikaas
eikaas / lib-pq.go
Created August 18, 2016 13:56
connect to postgres (bmizerany/pq)
package main
import (
"database/sql"
"log"
_ "github.com/bmizerany/pq"
)
/* Database and User creation in psql
@eikaas
eikaas / create-table-insert.go
Created August 18, 2016 20:29
PostgreSQL: Create table, insert row
package main
import (
"database/sql"
"fmt"
"log"
_ "github.com/bmizerany/pq"
)