Skip to content

Instantly share code, notes, and snippets.

<?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 April 10, 2013 16:29
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
[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 April 4, 2013 07:26
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.
#!/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 March 22, 2013 10:35
Useful snippet to calculate total memory used by a process
#!/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" ;};'