Skip to content

Instantly share code, notes, and snippets.

View thitu's full-sized avatar

NMT thitu

View GitHub Profile
#!/usr/bin/env bash
set -e
file=`mktemp`
input=$1
if [ -f "$input" ]; then
xmllint --pretty 1 $input > $file
mv $file $input
##
## I struggled to get a correct configuration of a rails service running
## behind an apache daemon as the proxy.
##
## This configuration worked for me.
##
<VirtualHost your-hostname.com:80>
ServerName your-hostname.com
ErrorLog /var/log/httpd/www.error.log
@thitu
thitu / lower.sh
Last active June 4, 2019 20:09
lower case conversion with bash - first parameter or stdin via pipe
#!/usr/bin/env bash
if [ -n "$1" ]; then
echo ${1,,}
else
while read x; do echo ${x,,}; done
fi
@thitu
thitu / upper.sh
Last active June 4, 2019 20:09
upper case conversion with bash - first parameter or stdin via pipe
#!/usr/bin/env bash
if [ -n "$1" ]; then
echo ${1^^}
else
while read x; do echo ${x^^}; done
fi
@thitu
thitu / keybase.md
Created June 29, 2018 18:59
keybase.md

Keybase proof

I hereby claim:

  • I am thitu on github.
  • I am nikolas (https://keybase.io/nikolas) on keybase.
  • I have a public key ASB5AA1gGwHYeCueR1Fy2oIU55wMtU8UwybVtgu6CvGEjAo

To claim this, I am signing this object:

@thitu
thitu / trim.c
Last active August 24, 2022 13:50
trim whitespace in C
#ifndef MAX_STR
#define MAX_STR 1024
#endif
char *trim(const char *str) {
if(str == NULL) {
return NULL;
}