[tekwalk] xopen : shell function to have verbose xdg-open : Mac’s “open” alternative for Linux

Posted in AbhishekKr, Blogroll, install-on-linux with tags , , , , , , , on March 4, 2014 by abhishekkr

tekwalk.blogspot.in [13/Feb/2014]

http://tekwalk.blogspot.in/2014/02/xopen-shell-function-to-have-verbose.html

I have been using xdg-open for sometime now, it’s a utility similar to “open” utility popular among MacOSx users.

It enables you to open any file in the default “open with” program assigned to it’s type. So, just passing any type of file to this utility would let you open it in the program it’s supposed to open.

What is xdg-open?
source[1]: https://wiki.archlinux.org/index.php/xdg-open
source[2]: http://linux.die.net/man/1/xdg-open

There is just this little shell function, that makes your xdg-open usage a bit more verbose in case of errors (bad-syntax/ghost-file/ghost-program/open-failure) faced about the reason for it. And also shortens the access util name obviously.

xopen ()
{
xdg-open “$@”;
_TMP_EXITCODE=$?;
if [ "${_TMP_EXITCODE}" == "1" ]; then
echo “[ERROR:] Error in command line syntax”;
else
if [ "${_TMP_EXITCODE}" == "2" ]; then
echo “[ERROR:] One of the files passed on the command line did not exist”;
else
if [ "${_TMP_EXITCODE}" == "3" ]; then
echo “[ERROR:] A required tool could not be found”;
else
if [ "${_TMP_EXITCODE}" == "4" ]; then
echo “[ERROR:] The action failed”;
fi;
fi;
fi;
fi;
return $_TMP_EXITCODE
}

…read full blogpost here

[just.few.tuts] golang ~ get local changes into GOPATH without pushing them upstream

Posted in AbhishekKr, Blogroll, tutorial with tags , , , , on March 4, 2014 by abhishekkr

justfewtuts.blogspot.in [3/Feb/2014]

http://justfewtuts.blogspot.in/2014/02/golang-get-local-changes-into-gopath.html

To get your local Golang repo’s sym-linked at your GOPATH and local changes available…

goenv_link(){
  if [ $# -ne 2 ]; then
    echo "Links up current dir to it's go-get location in GOPATH"
    echo "SYNTAX: goenv_linkme  "
    return 1
  fi
  _REPO_DIR=$1
  _REPO_URL=$2

  _TMP_PWD=$PWD
  cd $_REPO_DIR

  if [ -d "${GOPATH}/src/${_REPO_URL}" ]; then
    echo "$_REPO_URL already exists at GOPATH $GOPATH"
    go get "${_REPO_URL}"
    return 1
  fi
  _REPO_BASEDIR=$(dirname "${GOPATH}/src/${_REPO_URL}")
  if [ ! -d "${_REPO_BASEDIR}" ]; then
    mkdir -p "${_REPO_BASEDIR}/src"
  fi

  ln -sf "${PWD}" "${GOPATH}/src/${_REPO_URL}"
  go get "${_REPO_URL}"

  cd $_TMP_PWD
}

alias goenv_linkme="goenv_link $PWD"

…read full blogpost here

[just.few.tuts] go get pkg ~ easy made easier for project dependency management

Posted in AbhishekKr, Blogroll, tutorial with tags , , , , , , on March 4, 2014 by abhishekkr

justfewtuts.blogspot.in [5/Dec/2013]

http://justfewtuts.blogspot.in/2013/12/go-get-pkg-easy-made-easier-for-project.html

For past sometime I’ve been trying out ways to improve practices upon awesome capabilities from GoLang. One of the things have been having a ‘bundle install’ (for ruby folks) or ‘pip require -e’ (for python folks)  style capability… something that just refers to an text file part of source code and plainly fetches all the dependencies path mentioned in there (for all others).

It and some other bits can be referred here…
https://github.com/abhishekkr/tux-svc-mux/blob/master/shell_profile/a.golang.sh#L31

… …  …

What it do?

If ran without any parameters. It checks for current working directory for a file called ‘go-get-pkg.txt’. If not found creates one empty file by that name. To be done at initialization of project. If found, then it iterates through each line and pass it directly to “get get ${line}”. If ran with parameters. Each parameter is treated as path to files similar to ‘go-get-pkg.txt’ and similar action as explained previously is performed on each file.

Sample ‘go-get-pkg.txt’ file
-tags zmq_3_x github.com/alecthomas/gozmq github.com/abhishekkr/levigoNS github.com/abhishekkr/goshare

…read full blogpost here

[just.few.tuts] systemd enabled lightweight NameSpace Containers ~ QuickStart Guide

Posted in AbhishekKr, tutorial with tags , , , , , , , , , , on November 19, 2013 by abhishekkr

justfewtuts.blogspot.in [15/Nov/2013]

http://justfewtuts.blogspot.in/2013/11/systemd-enabled-lightweight-namespace.html

systemd (for some time now) provides a powerful chroot alternative to linux users for creating quick and lightweight system containers using power ofcgroups and socket activation.

There is a lot more to “systemd” than this, but that’s for some other post. Until then can explore it, starting here.

There is a utility “systemd-nspawn” provided by systemd which acts as container manager. This is what can be used to easily spawn a new linux container and manage it. It has been updated with (the systemd’s amazing trademark feature) Socket Activation.

This enables any container to make parent/host’s systemd instance to listen at different service ports for itself. Only when those service ports receive a connection, these container will spawn and act to it. Voila, resource utilization and scalability concepts.
More of this can read in detail at: http://0pointer.de/blog/projects/socket-activated-containers.html

Here we’ll see some way to quickly start using it via some custom made commands.

…..

…..

…..read full blogpost here

[hackersmag] HTTP Referer Spoofing, don’t get confused, don’t worry, Block or Avoid

Posted in AbhishekKr, security with tags , , , , , , , , on November 19, 2013 by abhishekkr

hackersmag.blogspot.in [30/Oct/2013]

http://hackersmag.blogspot.in/2013/10/http-referer-spoofing-dont-get-confused.html

HTTP Referer?
It’s an optional HTTP Request Header which can be set to URI to inform the WebServer the source URI which led the client to current URI.

Analytics Benefit:
It’s useful for Web content publishers for analysis sake as per which are the web portals that are attractive more visitors to that URI.

Security Benefit:
It has also been seen to be used as an extra layer of check by WebApps to confirm if the requested URI has been accessed via proper channels and respond accordingly.

HTTP Referer Spoofing ?

As other popular spoofing attack this doesn’t involve attacker trying to hide their identity.

…..
…..

Threat ?
There are potential 2 types of threats which arise from it:
…..
….. 
Solution ?
…..
…..
read full blogpost here

[tux-install] Counter-Strike (Steam) on ArchLinux via Wine

Posted in AbhishekKr, install-on-linux with tags , , , , , , , , on November 19, 2013 by abhishekkr

tuxinstall.blogspot.in [30/Oct/2013]

http://tuxinstall.blogspot.in/2013/10/counter-strike-steam-on-archlinux-via.html

get the required base package available at archlinux

sudo pacman -S –noconfirm wine winetricks

sudo pacman -S –noconfirm wine_gecko wine-monoq4wine

try to get “steam” installed the proper way

winetricks steam

if the above command fails the next two commands shall do the job, although you’ll need to download aria2.exe (and unzip) and maybe SteamInstall.msi (if not found)

msiexec /i ~/.cache/winetricks/steam/SteamInstall.msi

wine arial32.exe /Q

now the system is ready to run Steam Client, try following script to run it (otherwise there might be some font not displaying or other issues)

#!/bin/bash

export WINEPREFIX=$HOME/.steam

export WINEDEBUG=-all

nice -n 19 wine ~/.wine/drive_c/Program\ Files\ \(x86\)/Steam/Steam.exe -no-dwrite

#####end-of-script

using it you can start your Steam Client, then it’s common way as other platforms to log-in to your Steam Account and install Counter Strike or any other game you play

…source blog here

[tux-install] yum-my ~ get your public yum-repo rolling on Google AppEngine

Posted in AbhishekKr, install-on-linux with tags , , , , , , , , , , on November 19, 2013 by abhishekkr

tuxinstall.blogspot.in [25/Aug/2013]

http://tuxinstall.blogspot.in/2013/08/yum-my-get-your-public-yum-repo-rolling.html

Wanna get your public yum repository rolling,

Get started by cloning boilerplate code…

$ git clone https://github.com/abhishekkr/gae-flat-web.git

$ cd gae-flat-web
$ mkdir -p yummy/<distro><releasever>/<basearch>

$ cp <all_my_rpms_of__distro_releasever_basearch> yummy/<distro><releasever>/<basearch>

$ createrepo yummy/<distro><releasever>/<basearch>/

now, place a file ‘flat_web/yum-my-el6<or-whichever>.repo’ with content

[yum-my-<distro><releasever>-<basearch>]
name=Yum-My
baseurl=http://YOURYUMMY.appspot.com/yummy/<distro>$releasever/$basearch
enabled=1
gpgcheck=0

and can link this file on your ‘flat_web/index.htm’ homepage to host: $ google_appengine/appcfg.py update <yum-my_path>

have a look at my repo code @ https://github.com/abhishekkr/gae-yum-my.git

For demo, here is the one I’m hosting
http://yum-my.appspot.com/flat_web/index.htm

…source blogpost here

Follow

Get every new post delivered to your Inbox.