Skip to content

Instantly share code, notes, and snippets.

View arpith20's full-sized avatar
💭

Arpith K Sharma arpith20

💭
View GitHub Profile
@arpith20
arpith20 / crop.sh
Created October 16, 2017 02:02
A script to crop a batch of images around a face. This was written to automatically extract and crop faces for use in people's section in IISc CSA's website.
for file in ../*.JPG; do
name=$(basename "$file")
i=0
./facedetect --biggest --center "$file" | while read x y; do
convert "$file" -crop 2521x2801+`expr ${x} - 1261`+`expr ${y} - 1200` "../face/${name%.*}_${i}.${name##*.}"
convert "../face/${name%.*}_${i}.${name##*.}" -resize 135x150 "../face/${name%.*}.${name##*.}"
rm "../face/${name%.*}_${i}.${name##*.}"
mogrify -format png "../face/${name%.*}.${name##*.}"
rm "../face/${name%.*}.${name##*.}"
pngquant "../face/${name%.*}.png" --output "../face/${name%.*}.png" --force
@arpith20
arpith20 / convert-encoding.sh
Created January 13, 2017 08:50
Shell script to convert encoding of files to utf-8.
#!/bin/bash
if [ $# -lt 1 ]
then
echo "Usage: "$0" <file_name>"
echo "Convert files to utf-8"
exit
fi
for i in $*
do
@arpith20
arpith20 / CSS: Message Boxes
Created May 8, 2016 08:57 — forked from csndra0504/CSS: Message Boxes
Css message boxes: Info, Success, Warning, Error, Validation
<!DOCTYPE HTML>
<html>
<head>
<style>
body{
font-family: Arial, Helvetica, sans-serif;
font-size: 13px;
}
.info, .success, .warning, .error, .validation {
border: 1px solid;