Base64 encoding with openssl:
echo -n 'encode this with base64' | openssl enc -base64
ZW5jb2RlIHRoaXMgd2l0aCBiYXNlNjQ=
Base64 decoding with openssl:
echo 'ZW5jb2RlIHRoaXMgd2l0aCBiYXNlNjQ=' | openssl enc -base64 -d
encode this with base64
base64 encoding decoding with opensslSubmitted by sandip on Thu, 08/30/2012 - 16:28Base64 encoding with openssl: echo -n 'encode this with base64' | openssl enc -base64 Base64 decoding with openssl: echo 'ZW5jb2RlIHRoaXMgd2l0aCBiYXNlNjQ=' | openssl enc -base64 -d »
Handling filenames with spaces, carriage returns or other control charactersSubmitted by sandip on Mon, 08/27/2012 - 23:42find -print0 | while IFS= read -rd $'\0' filename ; do echo "[$filename]" ; done -print0, prints the full file name on the standard output, followed by a null character instead of the newline character. IFS, is the "Internal Field Separator" that is used for word splitting after expansion. Here, IFS is set to null string. -r, specifies that backslash "\" does not act as an escape character. -d, is the delimeter. Which in this case is the null character '\0'. $'\0', the $ prefixed single quoted string decodes the backslash escape character. In this case a null character. [], is simply there to print out the text, so you notice any spaces in the beginning and end of text. »
Get public IP AddressSubmitted by sandip on Mon, 08/27/2012 - 21:01Get current public IP via command line curl and wget. With curl: curl icanhazip.com With wget: wget -qO- icanhazip.com »
host map: lookup (domain): deferredSubmitted by sandip on Tue, 08/21/2012 - 09:17(via www.brandonhutchinson.com) This Sendmail error--also seen as "Transient parse error -- message queued for future delivery" or "Name server: domain: host not found"--indicates that Sendmail encountered a problem with one of its DNS resource record lookups of the destination domain. redirect stdout/stderr within bash scriptSubmitted by sandip on Fri, 06/22/2012 - 08:04This executes the date command via shell script and logs it to the specified file with current pid. #!/bin/bash »
vBulletin login quotaSubmitted by sandip on Thu, 06/07/2012 - 10:20If you have typed in your admin password in vBulletin more than 5 times and get locked. Look at the vbulletin "strikes" table and truncate it to get back in and not have to wait for the 15 minutes lock out time. TRUNCATE strikes; »
Extract IP addressSubmitted by sandip on Tue, 05/15/2012 - 15:22One liner with grep to extract the IP addresses from a file. grep -Eo '([0-9]{1,3}\.){3}[0-9]{1,3}' /path/to/file The "-o" option prints only the matched parts. One liner with perl: perl -ne 'print if s/.*((\d{1,3}\.){3}\d{1,3}).*/\1/' /path/to/file Find size of ext3 JournalSubmitted by sandip on Fri, 04/13/2012 - 15:01The journal is located at inode: # tune2fs -l /dev/sda1 | awk '/Journal inode/ {print $3}' The size of journal in Bytes is: # debugfs -R "stat <inodenumber>" /dev/sda1 | awk '/Size: /{print $6}'|head -1 Note: "<>" is necessary around the inode number. »
group writable web folders with setgid and ACLSubmitted by sandip on Tue, 04/03/2012 - 10:18Often times, there is need for web-accessible folders to be set up so all web-developers have write access. Along with setgid option, ACL can be used so anyone in the group "web-developers" So unless the acl privileges is revoked specifically, it would just continue to work. To enable ACL, add "acl" option to /etc/fstab file for the corresponding partition and remount. Edit /etc/fstab: /dev/mapper/home /home ext4 defaults,acl 0 2 Remount: # mount -o remount /home Here is the commands to be used for the setup: # groupadd developers Now anyone needing write access can be put in the "developers" group. # usermod -G developers {username} If you need the webserver to have write access to certain folders, then chown the location to be owned by the webserver, instead of giving write permissions to all. # chown apache /path/to/docroot/apache »
Getting the most out of GrubSubmitted by sandip on Tue, 04/03/2012 - 07:40(via www.timburgess.net) The grub bootloader is particularly useful, especially when upgrading and testing new kernels. I recently found a way to modifiy the default boot config to make it useful when you wish to remotely upgrade a kernel and boot into it once only without being at the console to change the default back. ![]() |
User loginPopular contentToday's:All time:Tag CloudApache
AWK
Bash
BlogMarks
centos
Cheatsheet
cpu
DirectAdmin
Drupal
ensim
ext3
ftp
Hosting
imap
Information Technology
ip
ispconfig
Java
Kernel
lftp
lighttpd
Linux
lvm
mail
mailq
md5
Multimedia
munin
munin-node
MySQL
Networking
oneliner
openssl
openvz
Perl
PHP
Plesk
PostgreSQL
proftpd
Programming
qmail
redhat
rpm
screen
Scripting
Security
Sendmail
site migration
spf
ssh
ssl
svn
tips
Tips and Tricks
Tipsheet
trac
Tutorials
ubuntu
upgrade
Web Development
Who's new
Who's onlineThere are currently 0 users and 1 guest online.
LinksFOSS Community: |
Recent comments
6 years 27 weeks ago
6 years 27 weeks ago
6 years 27 weeks ago
6 years 27 weeks ago
7 years 7 weeks ago
7 years 9 weeks ago
7 years 32 weeks ago
7 years 38 weeks ago
7 years 39 weeks ago
7 years 47 weeks ago