Do you know the lifehacker site? It’s better you don’t. If you’re now curious and would like to check it out at least turn on adblock. They wrote a comment about 4k monitors on their 4k monitor post yesterday before I went to bed since I just got my 4k monitor the same day and…
Read ArticleCategory: Allgemein
A JWT keyserver written in Go
https://github.com/gomango/keyserver My own creation but it would not have been possible without https://github.com/dgrijalva/jwt-go Update this repo is no longer available because github chose to harass me and disable my account. The official reason was that I had more than 1 account. Well I deleted all my organizations and repos and the account, which’s username then…
Read ArticleGo Private Public RSA
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
package main import ( "crypto/rand" "crypto/rsa" "crypto/x509" "encoding/pem" "fmt" ) type ( App struct { Private *rsa.PublicKey Public []byte //Secret []byte } ) func main() { app := new(App) if err := app.GenerateKey(); err != nil { panic(err) } privpem := pem.EncodeToMemory( &pem.Block{ Type: "RSA PRIVATE KEY", Bytes: x509.MarshalPKCS1PrivateKey(app.Private), }, ) fmt.Printf("%s\n", privpem) pubbytes, err := x509.MarshalPKIXPublicKey(&app.Private.PublicKey) if err != nil { panic(err) } pubpem := pem.EncodeToMemory( &pem.Block{ Type: "RSA PUBLIC KEY", Bytes: pubbytes, }, ) fmt.Printf("%s\n", pubpem) } func NewApp() *App { return &App{ PrivateKey: make([]byte, 0), PublicKey: make([]byte, 0), //Secret: make([]byte, 0), } } func (this *App) GenerateKey() error { if priv, err := rsa.GenerateKey(rand.Reader, 2048); err != nil { return err } else { if err := priv.Validate(); err != nil { return err } this.Private = priv return nil } } |
Read Article
Secure AngularJS app
No one has a fucking clue how to write secure AngularJS apps. Prove me wrong! I’m sorry to contribute to the heap of spam on the internet with no real content, however this still seems to hold true almost 3 years later.
Read ArticleSoftware RAID replace failed harddisk
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
cat /proc/mdstat Personalities : [raid0] [raid1] [raid6] [raid5] [raid4] [raid10] md3 : active raid1 sda4[3] sdb4[2] 2778744127 blocks super 1.2 [2/1] [_U] [>....................] recovery = 1.3% (38884416/2778744127) finish=534.3min speed=85452K/sec md2 : active raid1 sda3[3] sdb3[2] 134216632 blocks super 1.2 [2/2] [UU] md1 : active raid1 sda2[3] sdb2[2] 524276 blocks super 1.2 [2/2] [UU] md0 : active (auto-read-only) raid1 sda1[3] sdb1[2] 16776120 blocks super 1.2 [2/2] [UU] unused devices: <none> mdadm --manage /dev/md0 --fail /dev/sda1 mdadm --manage /dev/md1 --fail /dev/sda2 mdadm --manage /dev/md2 --fail /dev/sda3 mdadm --manage /dev/md3 --fail /dev/sda4 mdadm --manage /dev/md0 --remove /dev/sda1 mdadm --manage /dev/md1 --remove /dev/sda2 mdadm --manage /dev/md2 --remove /dev/sda3 mdadm --manage /dev/md3 --remove /dev/sda4 shutdown and remove failed disk boot mdadm --manage /dev/md0 --add /dev/sda1 mdadm --manage /dev/md1 --add /dev/sda2 mdadm --manage /dev/md2 --add /dev/sda3 mdadm --manage /dev/md3 --add /dev/sda4 watch cat /proc/mdstat |