Skip to content

Instantly share code, notes, and snippets.

Harish Karumuthil harish2704

Block or report user

Report or block harish2704

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View capacitance.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@harish2704
harish2704 / snmp_count_process.sh
Created Dec 28, 2018
Count number of process matching given process name and arguments using snmp protocol
View snmp_count_process.sh
#!/bin/bash
listProcessNameMib=.1.3.6.1.2.1.25.4.2.1.2
listProcessArgsMib=.1.3.6.1.2.1.25.4.2.1.5
snmpHost=$1
snmpCommunity=$2
shift
shift
processName=$@
@harish2704
harish2704 / zypper_dup_print_urls.py
Created Oct 1, 2018
parallel downloads while doing zypper distribution upgrade
View zypper_dup_print_urls.py
#!/usr/bin/env python2
"""
This script will print package urls which need to be downloaded for 'distrubution upgrade'
Printed urls can be used for downloading packages in parallel.
For eg: we can use GNU parallel commanline tool along with wget/curl for parallel downloading
python2 zypper_dup_print_urls.py | parallel --tmuxpane -j4 --colsep ' ' mkdir -p '{1}/{2}' \; cd '{1}/{2}' \; wget -c {3}
will download packages with 4 simultaneous downloads
"""
@harish2704
harish2704 / json_format.sh
Created Sep 25, 2018
Pretty print / format JSON from STDIN using nodejs. single line solution.
View json_format.sh
node -e "console.log( JSON.stringify( JSON.parse(require('fs').readFileSync(0) ), null, 1 ))"
# Exapmle usage
# echo unformated.json | node -e "console.log( JSON.stringify( JSON.parse(require('fs').readFileSync(0) ), null, 1 ))"
@harish2704
harish2704 / dbus_handler.py
Last active Apr 21, 2018 — forked from DarkXanteR/dbus_handler.py
Python DBus handle hibernate, sleep and resume
View dbus_handler.py
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = 'xanter'
#from datetime import datetime
import signal
import time
import dbus
import gobject
import urllib2
View create-user.sql
CREATE USER 'hari'@'%' IDENTIFIED VIA mysql_native_password USING '***';
--- GRANT USAGE ON *.* TO 'hari'@'%' REQUIRE NONE WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0;
GRANT USAGE ON *.* TO 'hari'@'%' ;
CREATE DATABASE IF NOT EXISTS `hari`;
GRANT ALL PRIVILEGES ON `hari`.* TO 'hari'@'%';
@harish2704
harish2704 / run-parallel.sh
Last active Jul 1, 2018
parallel downloading with proxies in shell script
View run-parallel.sh
#!/usr/bin/env bash
#
# Usage: run-parallel.sh <URL-list> <proxy-list> <parallel-job-count> <cmd>
# Environment variables
# - SKIP_PROXY_VALIDATION - if set, skip proxy list validation step.
# - OUTPUT - default value is 'tmux' which will send each jobs to tmux session. for any string, output of each jobs will be saved inside directory tree with given name
urlListRaw=$1
proxyListRaw=$2
@harish2704
harish2704 / rpm-mk-build-deps.sh
Last active Mar 17, 2018
mk-build-deps equivalent for rpm. Generate dummy rpm package satisfying build deps of a spec file
View rpm-mk-build-deps.sh
#!/usr/bin/env bash
#
# Usage: rpm-mk-build-deps.sh <path_to_spec_file>
#
mkBuildDeps(){
specFile=$1
pkgName=$(rpmspec -q $specFile --qf '%{name}')
pkgVersion=$(rpmspec -q $specFile --qf '%{version}')
View rename-chrome-extensions.sh
file-roller --extract-here *
for i in $(ls -d */); do
extId=$( cat $i/metadata.json | grep uuid | sed 's/.*"uuid".*"\(.*\)".*/\1/' );
mv $i $extId;
done
@harish2704
harish2704 / Readme.md
Created Dec 1, 2017
Routing network traffic of specific process through specific interface in linux
View Readme.md

Consider we have two working ether net connections. One will be set as default by system.

What if we want to route all the network traffic for a specific process through a specific network interface ? In Linux, we can do this easily

My current configuration is this.

enp0s26u1u2 Link encap:Ethernet  HWaddr 02:45:4a:37:5a:28  
You can’t perform that action at this time.