Skip to content

Instantly share code, notes, and snippets.

@petasittek
petasittek / gist:1378951
Last active July 1, 2023 01:24
Find all subdomains of given domain with dig
# let's dig the server
dig example.com
# from the DNS answer we are interested in the authority section
#;; AUTHORITY SECTION:
#example.com. 79275 IN NS a.iana-servers.net.
#example.com. 79275 IN NS b.iana-servers.net.
# now we find out all subdomains
dig @a.iana-servers.net example.com axfr
@petasittek
petasittek / gist:1325171
Created October 29, 2011 22:23
Free page cache, inodes and dentries cache
# flush file system buffers (cache > disk)
sudo sync
# free page cache
sudo -s "echo 1 > /proc/sys/vm/drop_caches"
# free inodes and dentries cache
sudo -s "echo 2 > /proc/sys/vm/drop_caches"
# free page cache, inodes and dentries cache
@petasittek
petasittek / gist:1292143
Created October 17, 2011 07:40
Save cron output to file with a timestamp in its filename
# do not forget to escape % to \% in date's parameter
* * * * * /usr/bin/php /path/script.php > /var/log/output-`date +\%Y\%m\%d\%H\%M`.log 2>&1
@petasittek
petasittek / gist:1291452
Created October 16, 2011 21:37
Load jQuery via bookmarklet
javascript:el=document.createElement('script');el.src='http://code.jquery.com/jquery-latest.min.js';document.body.appendChild(el);
@petasittek
petasittek / gist:1287696
Created October 14, 2011 17:08
MySQL - root password reset
sudo /etc/init.d/mysql stop
# we have to --skip-networking to prevent connections out of localhost because mysql will now run absolutely unprotected
sudo /usr/sbin/mysqld --skip-grant-tables --skip-networking &
mysql -u root
# reload privileges from grant tables (free cached memory)
FLUSH PRIVILEGES;
USE mysql;
# set your new password
UPDATE user SET Password = PASSWORD('new password') WHERE Host = 'localhost' AND User = 'root';
# reload the privileges again
@petasittek
petasittek / gist:1274159
Created October 9, 2011 20:51
EncFS on Dropbox
# APPLICABLE FOR UBUNTU/DEBIAN
# install encfs and fuse
sudo apt-get install fuse-utils encfs
# add fuse module to Linux Kernel
sudo modprobe fuse
# add fuse to end of /etc/modules to autoload fuse module
sudo nano /etc/modules