Skip to content

Instantly share code, notes, and snippets.

Avatar

Rohit Bhute rvbhute

View GitHub Profile
View gist:6315810
<?php
$sendToQueue = function($num) {
$parameters = []; // parameters including $num
Rabbit::enqueue('comms', 'sms', $parameters, 'topic');
};
array_walk($numbers, $sendToQueue($num));
@rvbhute
rvbhute / create-cbz.desktop
Created Apr 10, 2013
Custom KDE service menu entry to create a CBZ archive from a directory of images. Drop this file in your service menu folder - ~/.kde/share/kde4/services
View create-cbz.desktop
[Desktop Entry]
Type=Service
ServiceTypes=KonqPopupMenu/Plugin
MimeType=inode/directory;
Actions=createCBZ
[Desktop Action createCBZ]
Name=Create CBZ
Exec=zip "%u.cbz" %u/*.*
Icon=ark
@rvbhute
rvbhute / create-cbz.sh
Created Apr 4, 2013
Two versions for creating CBZ (Comic Book archive) files out of a directory of images. These files can be opened in comic readers. In Linux, applications like Evince also handle CBZ files with ease.
View create-cbz.sh
#!/bin/sh
# First version, to use only a particular file-type in a folder
for f in `ls -l | egrep '^d' | awk '{print $NF}'`
do
cd $f
zip $f.cbz *.jpg
mv $f.cbz ../$f.cbz
cd ..
@rvbhute
rvbhute / psmem.sh
Created Mar 22, 2013
Useful snippet to calculate total memory used by a process
View psmem.sh
#!/bin/sh
# psmem.sh
# http://abdussamad.com/archives/488-Memory-usage-of-a-process-under-Linux.html
ps -C $1 -O rss | gawk '{ count ++; sum += $2 }; END {count --; print "Number of processes =",count; print "Memory usage per process =",sum/1024/count, "MB"; print "Total memory usage =", sum/1024, "MB" ;};'