Skip to content

Instantly share code, notes, and snippets.

View jyap808's full-sized avatar

Julian Y jyap808

View GitHub Profile
@jyap808
jyap808 / rport.js
Created September 20, 2011 02:29
from node.js sip.js module
var sip = require('sip');
var udp = require('dgram');
var assert = require('assert');
var util = require('util');
sip.start({}, function(rq) { sip.send(sip.makeResponse(rq, 500)); });
var socket = udp.createSocket('udp4');
socket.bind(6060);
@jyap808
jyap808 / decrypt_gpg_armor.go
Created January 4, 2014 01:05
Decrypting an ASCII armored GPG encrypted string in Golang
package main
import (
"bytes"
"code.google.com/p/go.crypto/openpgp"
"code.google.com/p/go.crypto/openpgp/armor"
"fmt"
"io/ioutil"
"log"
)
@jyap808
jyap808 / encrypt_decrypt_gpg_armor.go
Created January 4, 2014 01:12
Symmetrically encrypting a string into ASCII armored GPG format and then Decrypting it in Golang
package main
import (
"bytes"
"code.google.com/p/go.crypto/openpgp"
"code.google.com/p/go.crypto/openpgp/armor"
"fmt"
"io/ioutil"
"log"
)
@jyap808
jyap808 / text_template_example.go
Created January 5, 2014 07:59
Example of using the "text/template" module
package main
import (
"os"
"text/template"
)
type Person struct {
Name string //exported field since it begins with a capital letter
}
@jyap808
jyap808 / decrypt_gpg_armor_using_passphrase_private_key.go
Created January 8, 2014 01:14
Decrypting an ASCII armored GPG encrypted string using a passphrase protected private key in ASCII armor format
package main
import (
"bytes"
"code.google.com/p/go.crypto/openpgp"
"code.google.com/p/go.crypto/openpgp/armor"
"fmt"
"io/ioutil"
"log"
)
@jyap808
jyap808 / decrypt_gpg_armor_private_key.go
Created January 8, 2014 01:25
Decrypting an ASCII armored GPG encrypted string using a private key (no passphrase) in ASCII armor format
package main
import (
"bytes"
"code.google.com/p/go.crypto/openpgp"
"code.google.com/p/go.crypto/openpgp/armor"
"fmt"
"io/ioutil"
"log"
)
@jyap808
jyap808 / public_key_encrypt_gpg_base64.go
Last active May 21, 2021 16:39
Public key encrypting a string into GPG format and outputting it in base64 encoding
package main
import (
"bytes"
"code.google.com/p/go.crypto/openpgp"
"encoding/base64"
"fmt"
"io/ioutil"
"log"
)
@jyap808
jyap808 / public_key_decrypt_gpg_base64.go
Created January 9, 2014 20:32
Decrypting a base64 GPG public key encrypted string using a passphrase protected private key in ASCII armor format
package main
import (
"bytes"
"code.google.com/p/go.crypto/openpgp"
"encoding/base64"
"fmt"
"io/ioutil"
"log"
)
@jyap808
jyap808 / resize_ext4_lvm_boot_cd.md
Last active January 4, 2016 20:49
Resize an ext4 LVM volume with a boot CD

Find the name of the Volume Group (henceforth “somevg”) that contains the root Logical Volume:

sudo lvs

(If it’s not showing up, try running sudo lvmdiskscan and sudo pvscan then try again.)

If you run ls /dev/mapper/ you may see that the Logical Volumes is not showing up. If it’s not there, you need to run the following command to make the kernel aware of the logical volumes:

sudo vgchange --available y <somevg>
@jyap808
jyap808 / resize_swap_lvm.md
Created January 28, 2014 21:33
Resize a swap LVM volume
swapoff /dev/vg_foo/lv_swap
lvextend -L+100M /dev/vg_foo/lv_swap
mkswap /dev/vg_foo/lv_swap
swapon /dev/vg_foo/lv_swap

That is: disable swapping on the volume, extend it, re-create the swap area and enable swapping again.

Swap will need to be recreated with mkswap to the new size to be seen.

Modified From: http://oxygene.sk/2009/12/resizing-a-lvm-swap-volume/