Skip to content

Instantly share code, notes, and snippets.

View arindamchoudhury's full-sized avatar

Arindam Choudhury arindamchoudhury

  • Ackstorm
  • Barcelona, Spain
View GitHub Profile
@arindamchoudhury
arindamchoudhury / managing br-ex on single NIC
Last active August 29, 2015 14:01
managing br-ex on single NIC
ip addr add 172.24.4.229/28 dev br-ex
iptables -t nat -I POSTROUTING 1 -s 172.24.4.224/28 -j MASQUERADE
@arindamchoudhury
arindamchoudhury / gist:b8b238bffbfde532efc2
Created June 18, 2014 10:42
Determining Disk Controller
[root@aopcach ~]# ll /sys/block/
total 0
lrwxrwxrwx 1 root root 0 Jun 17 10:37 dm-0 -> ../devices/virtual/block/dm-0
lrwxrwxrwx 1 root root 0 Jun 17 12:37 dm-1 -> ../devices/virtual/block/dm-1
lrwxrwxrwx 1 root root 0 Jun 17 10:37 dm-2 -> ../devices/virtual/block/dm-2
lrwxrwxrwx 1 root root 0 Jun 17 10:40 dm-3 -> ../devices/virtual/block/dm-3
lrwxrwxrwx 1 root root 0 Jun 17 10:37 loop0 -> ../devices/virtual/block/loop0
lrwxrwxrwx 1 root root 0 Jun 17 10:40 loop1 -> ../devices/virtual/block/loop1
lrwxrwxrwx 1 root root 0 Jun 17 10:40 loop2 -> ../devices/virtual/block/loop2
lrwxrwxrwx 1 root root 0 Jun 17 10:40 loop3 -> ../devices/virtual/block/loop3
@arindamchoudhury
arindamchoudhury / gist:4e9e63bd500e65c77a4b
Created November 18, 2014 08:49
Installing wifi card on debian
1. use dmesg to find out the device:
[ 987.836474] iwl3945 0000:0c:00.0: firmware: agent aborted loading iwlwifi-3945-2.ucode (not found?)
[ 987.844596] iwl3945 0000:0c:00.0: firmware: agent aborted loading iwlwifi-3945-1.ucode (not found?)
[ 987.844755] iwl3945 0000:0c:00.0: Could not read microcode: -2
2. add non-fee repo:
# head /etc/apt/sources.list
#
#!/usr/bin/python
from gi.repository import PackageKitGlib
# this fails in install_packages(), as the Epson archive is not actually signed
#repo = 'deb http://download.ebz.epson.net/dsc/op/stable/debian lsb3.2 main'
#repo_gpg_id = '8AA65D56'
#package = 'epson-inkjet-printer-px-402a'
# this works
client = PackageKitGlib.Client()
print 'refreshing cache'
client.refresh_cache(False, None, lambda p, t, d: True, None)
print 'cache refreshing done'
print 'getting updates'
res = client.get_updates(PackageKitGlib.FilterEnum.NONE, None, lambda p, t, d: True, None)
dnf install @development-tools fedora-packager rpmdevtools git vim wget
yum makecache fast
yum update -y && yum install wget -y
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm && yum install epel-release-latest-7.noarch.rpm -y
wget https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm && yum install epel-release-latest-6.noarch.rpm -y
yum install -y python2 python-devel python-twisted-core python-twisted-web python-twisted-words python-configobj python-psutil libxml2-python python-simplejson rpm-python python-crypto python-httplib2 shadow-utils python-pip pygobject3 PolicyKit PackageKit dbus-python
@arindamchoudhury
arindamchoudhury / pkg-config
Created January 13, 2016 10:55
pkg-config
from commands import getstatusoutput
retcode, systemd_system_unit_dir = getstatusoutput('pkg-config systemd --variable=systemdsystemunitdir')
@arindamchoudhury
arindamchoudhury / agent.py
Created February 29, 2016 16:18
agent.py
# -*- coding:utf-8 -*-
# Copyright (C) 2012 Juan Carlos Moreno <juancarlos.moreno at ecmanaged.com>
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
apt-get install -y devscripts python-all-dev python-stdeb rng-tools git vim
rngd -r /dev/urandom
adduser newuser
getent group ecmanaged >/dev/null || groupadd -r ecmanaged
getent passwd ecmanaged >/dev/null || useradd -r -g ecmanaged -d /opt/ecmanaged -s /usr/sbin/nologin -c "account for running ecagent" ecmanaged
su - newuser
docker rmi -f $(docker images | grep "<none>" | awk "{print \$3}")