Skip to content

Instantly share code, notes, and snippets.


Kestutis Stalmokas stalmok

  • Vancouver, Canada
View GitHub Profile
stalmok / clean-svn
Created Apr 24, 2012
Unix CL: Remove all .svn folders in a directory tree
View clean-svn
find . -name ".svn" -type d -exec rm -rf {} \;
stalmok / platform_check
Created Jun 21, 2012
JavaScript: test if Mac or PC
View platform_check
if (navigator.userAgent.indexOf('Mac OS X') != -1) {
} else {
stalmok / readlink
Created Jul 9, 2012
Unix CL: Find Out Real Path Of File
View readlink
stalmok / drop-tables
Created Aug 16, 2012
Unix CL: drop all MySQL tables
View drop-tables
mysqldump -u username --no-data dbname | grep ^DROP | mysql -u username
mysqldump -u username -p --no-data dbname | grep ^DROP > drop.sql
mysql -u username -p dbname < drop.sql
stalmok / unix-search-in-file
Created Oct 12, 2012
Unix CL: search in files
View unix-search-in-file
find . -name "*" -exec grep -l "somestring" {} \;
stalmok / mysql-import
Created Oct 29, 2012
MySQL: Import Datafile
View mysql-import
mysql -u username -p -h localhost DATA-BASE-NAME < data.sql
stalmok / clear_cache.php
Created Nov 8, 2012
Drupal: clear cache
View clear_cache.php
stalmok / sql-replace-string
Created Nov 12, 2012
MySQL: replace string and update
View sql-replace-string
// replace string and update
update [table_name] set [field_name] = replace([field_name],'[string_to_find]','[string_to_replace]');
stalmok / restrict-access
Created Dec 5, 2012
Restrict user access to content in folders using PHP and Apache
View restrict-access
* Original post:
# The .htaccess file
RewriteEngine on
RewriteBase /
RewriteCond %{REQUEST_URI} ^\/(path\/to\/some\/folder|dummy)\/.*$
RewriteRule !^((.*.php)|(.*\/))$ authorize.php
stalmok / nginx-check-conf
Created Dec 21, 2012
Nginx: test configuration
View nginx-check-conf
nginx -t -c /etc/nginx/nginx.conf
You can’t perform that action at this time.