Skip to content

Instantly share code, notes, and snippets.

View prashanthpai's full-sized avatar

Prashanth Pai prashanthpai

View GitHub Profile
@prashanthpai
prashanthpai / static-ip.md
Last active July 15, 2016 09:33
Set Static IP in Fedora VM

Set Static IP

vim /etc/sysconfig/network-scripts/ifcfg-p7p1
TYPE=Ethernet
BOOTPROTO=static
NAME=p7p1
UUID=acd05c7f-20a5-4cf7-86f7-25a24e264620
@prashanthpai
prashanthpai / swift_db.md
Last active August 29, 2015 13:56
swift DB struncture (SP)

###Account DB tables

CREATE TABLE account_stat (
                account TEXT,
                created_at TEXT,
                put_timestamp TEXT DEFAULT '0',
                delete_timestamp TEXT DEFAULT '0',
                container_count INTEGER,
 object_count INTEGER DEFAULT 0,
@prashanthpai
prashanthpai / swiftonfile-sp.md
Last active April 26, 2016 13:42
SwiftOnFile Storage Policy Notes

###Storage Policy configurations All glusterfs volumes as a single storage policy with each volume being just a device to Swift: In this case, Swift hashes and chooses where to place objects into. Hence PUT of an object can go to either of the volumes. For example, if we have two glusterfs volumes test and test2, putting ten objects (named 1 to 10) into AUTH_abc account and container cg (marked with sp glusterfs) can look like so on mountpoint:

curl -i http://vm1:8080/v1/AUTH_abc/cg -X PUT -H 'X-Storage-Policy: glusterfs'
curl -i http://vm1:8080/v1/AUTH_abc/cg/o{1..10} -X PUT -d'testobject'
/mnt/gluster-object/test
@prashanthpai
prashanthpai / inotify-debug.md
Created August 8, 2014 09:09
Tracking inotify watches

Enable kernel debug tracing

echo 1 > /sys/kernel/debug/tracing/tracing_on

Enable tracing of all inotify syscalls

for i in `ls /sys/kernel/debug/tracing/events/syscalls | grep inotify`; do echo 1 >| /sys/kernel/debug/tracing/events/syscalls/$i/enable; done;
@prashanthpai
prashanthpai / swift-obj-name.md
Created October 6, 2014 21:06
swift object name mapping to on-disk file path

Calculating object hash:

>>> from swift.common.utils import hash_path
>>> print hash_path("AUTH_abc/c1/o4")
c2b307d78b6c419c0c1b76d91c08c69f

The corresponding on-disk object path derived from the above hash:

/mnt/sdb1/./3/node/sdb3/objects/778/69f/c2b307d78b6c419c0c1b76d91c08c69f/1412628708.01757.data
@prashanthpai
prashanthpai / airtel-4g.md
Last active January 8, 2018 07:09
Airtel 4G

Dongle: ZTE MF825A

Assuming 192.168.0.1 is the IP of your dongle:

Connect

http://192.168.0.1/goform/goform_set_cmd_process?goformId=CONNECT_NETWORK
@prashanthpai
prashanthpai / makedirs.md
Last active July 10, 2017 03:50
makedirs

When directory 'a' does NOT exist:

$ strace mkdir -p ./a/b/c

mkdir("a", 0775)                        = 0
open("a", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_DIRECTORY|O_NOFOLLOW) = 3
fchdir(3)                               = 0
close(3)                                = 0
mkdir("b", 0775)                        = 0
open("b", O_RDONLY|O_NOCTTY|O_NONBLOCK|O_DIRECTORY|O_NOFOLLOW) = 3
@prashanthpai
prashanthpai / clean_expired.py
Created December 18, 2014 12:01
Script to manually clean expired objects from GlusterFS volume.
#!/usr/bin/env python
import os
import argparse
import math
import time
import xattr
import cPickle
METADATA_KEY = 'user.swift.metadata'
@prashanthpai
prashanthpai / benchmarkRenamer.py
Last active April 26, 2016 13:42
Renamer() with and without fsync
#!/usr/bin/env python
import benchmark
import os
import uuid
import errno
import shutil
import random
import hashlib
#!/usr/bin/env python
# pip install benchmark
# Comparison of makedirs_count() vs swift.common.utils.mkdirs()
import benchmark
import os
import uuid
import errno