Skip to content

Instantly share code, notes, and snippets.

View mallamanis's full-sized avatar
:octocat:

Miltos mallamanis

:octocat:
View GitHub Profile
@mallamanis
mallamanis / resizeScript.sh
Created June 7, 2011 21:25
Resize All Pictures
#!/bin/bash
for doc in ./*.JPG; do
convert $doc -resize 50% $doc;
echo "Done with" $doc;
done
@mallamanis
mallamanis / pdf2tiff.sh
Created June 7, 2011 21:26
Convert .pdf to .tiff (Ktimatologio standard format)
#!/bin/bash
for doc in ./*.pdf; do
convert -units PixelsPerInch -density 150 -type Grayscale -depth 4 -monochrome -compress LZW $doc $doc.tif;
echo 'Done with' $doc;
done
@mallamanis
mallamanis / rmKernel.sh
Created June 7, 2011 21:28
Remove all old kernels (Ubuntu)
#/bin/bash
ls /boot/ | grep vmlinuz | sed 's@vmlinuz-@linux-image-@g' | grep -v `uname -r` > /tmp/kernelList
for I in `cat /tmp/kernelList`
do
aptitude remove $I
done
rm -f /tmp/kernelList
update-grub
@mallamanis
mallamanis / enableCoreDumps.sh
Created June 7, 2011 21:31
Debian core dumps enable
ulimit -c unlimited
echo 'core_%e.%t.%p' > /proc/sys/kernel/core_pattern
@mallamanis
mallamanis / DBbackup.sh
Created June 7, 2011 21:50
Simple MySQL Dump backup
#!/bin/bash
mysqldump --all-databases --user="username" --password="password" --single-transaction >/destination/folder/all_databases.sql
cd /destination/folder/
# Create new archive
ARCHIVE_NAME=DBs$(date '+%G%m%d%k').tar
tar -cvvf $ARCHIVE_NAME all_databases.sql
@mallamanis
mallamanis / gist:1106769
Created July 26, 2011 13:33
Addition to .bashrc for showing current git branch
export PS1="\[\033[38m\]\u@\h\[\033[01;34m\] \w \[\033[31m\]\`ruby -e \"print (%x{git branch 2> /dev/null}.grep(/^\*/).first || '').gsub(/^\* (.+)$/, '(\1) ')\"\`\[\033[37m\]$\[\033[00m\] "
@mallamanis
mallamanis / mysqldump_pre_commit_hook.bash
Created August 23, 2011 10:50 — forked from nuclearsandwich/mysqldump_pre_commit_hook.bash
A pre-commit hook for git which dumps and adds a mysql database to the repository just before commit.
#!/bin/bash
# Pre-commit hook to make a mysql dump right before committing and add it to the commit.
#
## Change the following values to suit your local setup.
# The name of a database user with read access to the database.
DBUSER=root
# The password associated with the above user. Leave commented if none.
DBPASS=seekrit
# The database associated with this repository.
DBNAME=dplay
@mallamanis
mallamanis / gist:1227178
Created September 19, 2011 18:22
convert unicode to international domain names from file
import encodings.idna
filename = '/path/to/names';
filePointer = open(filename,'r');
content = filePointer.read();
content = content.split("\n");
for line in content:
line = line.decode('utf-8');
@mallamanis
mallamanis / gist:1229904
Created September 20, 2011 18:36
Make all possible accent combinations of something (reading from file)
#!/usr/bin/env python
def generateChars(char):
if char == u'\u03ac' or char == u'\u03b1': #alpha
return (u'\u03ac',u'\u03b1');
elif char == u'\u03b5' or char == u'\u03ad': #epsilon
return (u'\u03b5', u'\u03ad');
elif char == u'\u03b7' or char == u'\u03ae': #ita
return (u'\u03b7',u'\u03ae');
@mallamanis
mallamanis / gist:1247758
Created September 28, 2011 11:53
Print all messages in ROS
#!/bin/bash
for line in $(rospack list-names)
do
for msg in $(rosmsg package $line)
do
echo 'Message ' $msg ' in ' $line
rosmsg show $msg
echo '-----------------------------------------------------'
done