Skip to content

Instantly share code, notes, and snippets.

View skarllot's full-sized avatar
💭
I may be slow to respond.

Fabrício Godoy skarllot

💭
I may be slow to respond.
View GitHub Profile
@skarllot
skarllot / telnet_smtp.diff
Last active August 29, 2015 14:25
Using Telnet to connect to SMTP server
telnet 25
helo example.com
-250 OK
mail from:
-250 OK - mail from
rcpt to:
-250 OK - Recipient
data
-354 Send data. End with CRLF.CRLF
To:
@skarllot
skarllot / grub-btrfs.conf
Created July 20, 2015 18:28
Move data around
kernel /vmlinuz root=/dev/sdX ro rootfsflags=subvol=<subvolume name>
@skarllot
skarllot / create-initrd.sh
Last active August 29, 2015 14:25
Create a new initrd (rescue CentOS 5)
mount --bind /proc /mnt/sysimage/proc
mount --bind /dev /mnt/sysimage/dev
mount --bind /sys /mnt/sysimage/sys
chroot /mnt/sysimage
cd /boot
mv initrd.img initrd.old.img
mkinitrd initrd-<ver>.img <ver>
cd /
sync; sync; sync
@skarllot
skarllot / rescan.sh
Last active August 29, 2015 14:25 — forked from rafaelfoster/rescan.sh
Linux device rescan/resize after virtual machine changes
# Reference: http://blog.gurudelleccelsopicco.org/2009/09/online-lun-expansion-and-partition-resizing-without-reboot-under-linux/
echo 1 > /sys/block/[DEVICE]/device/rescan
# DETECT IF NEW DISKS ARE ATTACHED TO THE HOST
# Reference: http://www.cyberciti.biz/tips/vmware-add-a-new-hard-disk-without-rebooting-guest.html
ls /sys/class/scsi_host
@skarllot
skarllot / timestamp.go
Last active May 23, 2017 13:23 — forked from bsphere/timestamp.go
A Time type that (un)marshal from/to unix timing
package timestamp
import (
"fmt"
"gopkg.in/mgo.v2/bson"
"strconv"
"time"
)
type Timestamp time.Time
@skarllot
skarllot / Example.go
Last active August 29, 2015 14:23 — forked from congjf/.Title
Using MongoDB in golang with mgo
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {
package main
import (
"fmt"
"labix.org/v2/mgo"
"labix.org/v2/mgo/bson"
"time"
)
type Person struct {
@skarllot
skarllot / enum.go
Created June 18, 2015 14:04
Enum-like types for Go (golang) that provides string representation
package main
import "fmt"
var enums []string
type Enum int
func (e Enum) String() string {
return enums[int(e)]
@skarllot
skarllot / meta-data
Created June 17, 2015 19:47
Cloud init
instance-id: server1
local-hostname: server1.example.com
network-interfaces: |
iface ens160 inet static
address 192.168.1.10
network 192.168.1.0
netmask 255.255.255.0
broadcast 192.168.1.255
gateway 192.168.1.1
@skarllot
skarllot / proxy-balancer.conf
Last active August 29, 2015 14:22
Apache proxy balancer
<VirtualHost *:443>
ProxyPass / balancer://webcluster/
ProxyPassReverse / balancer://webcluster/
Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/; secure; HttpOnly" env=BALANCER_ROUTE_CHANGED
# Non SSL
# Header add Set-Cookie "ROUTEID=.%{BALANCER_WORKER_ROUTE}e; path=/; HttpOnly" env=BALANCER_ROUTE_CHANGED
</VirtualHost>
<Proxy balancer://webcluster>