Skip to content

Instantly share code, notes, and snippets.

@cdolek
cdolek / linux_command_line_cheatsheet.txt
Last active December 24, 2015 21:49
linux command line cheatsheet
# kill multiple processes using keyword
kill -9 `ps -ef | grep keyword | grep -v grep | awk '{print $2}'`
# upgrade everything on debian
sudo apt-get update && sudo apt-get -y upgrade && sudo apt-get -y dist-upgrade && sudo apt-get -y autoremove
apt-get update && apt-get -y upgrade && apt-get -y dist-upgrade && apt-get -y autoremove
# viewing a user's ulimit's on debian (check /etc/security/limits.conf and /etc/pam.d/su)
su mysql -s /bin/sh -c "ulimit -a"
@cdolek
cdolek / template-worker.php
Last active August 29, 2015 14:01
Download attached images from a wordpress blog and save them into folders based on post title under uploads dir
<?php
/**
* Template Name: worker
*/
$args = array(
'posts_per_page'=> '-1',
'post_type'=> 'post',
'post_status' => array('publish'),
'order' => 'ASC',
@cdolek
cdolek / gist:a015abc3c09808fb14b7
Created October 31, 2014 00:50
haproxy v0.5 configuration for mysql cluster load balancing
global
log 127.0.0.1 local0 notice
chroot /var/lib/haproxy
user haproxy
group haproxy
# daemon
defaults
log global
# mode http
@cdolek
cdolek / gist:b72c81f813f03b043e37
Last active August 29, 2015 14:09
apache exclude static assets from access log
SetEnvIf Request_URI "\.gif$|\.jpg$|\.js$|\.css$|\.ico$|\.png$|\.ttf$|\.woff$|\.eot$|\.svg$|\.jpeg$|\.txt$" is_static
CustomLog /var/yourlogs/apache.access_log combined env=!is_static
@cdolek
cdolek / gist:89e24d71ce1a63c16e2d
Last active August 29, 2015 14:14
collecting vimeo video titles and links from vimeo.com // works on console
// paste
var jq = document.createElement('script');
jq.src = "https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js";
document.getElementsByTagName('head')[0].appendChild(jq);
// wait and paste
jQuery.noConflict();
// each paste will print the list on console, copy and paste + remove unnecessary lines
var a = jQuery('#browse_content li a');
@cdolek
cdolek / gist:e791429ae2890b3573d4
Last active October 19, 2015 17:33
exim: useful stuff for managing stuck emails
alias exim_summary="exim -bp | exiqsumm"
alias exim_log="tail -f /var/log/exim4/mainlog"
alias exim_force_send="exiqgrep -i | xargs exim -M"
alias exim_force_send_frozen="exiqgrep -zi | xargs exim -M"
# delete messages from the mail queue by receiver email address
exim -bp|grep "someone@somehost.com"| awk {'print $3'}| xargs exim -Mrm
@cdolek
cdolek / gist:4ad30938a88219811f5c
Created February 13, 2015 20:04
Creating folders from 0 to 12 -- zero padded (works on mac os x)
mkdir $(seq -f '%02.0f' 1 12)
creates folders:
01 02 03 04 05 06 07 08 09 10 11 12
@cdolek
cdolek / gist:372fc6421feffcd39860
Last active March 11, 2020 19:26
Utility for wordpress: Find missing attachment files, non writable upload directories and meta errors
<?php
/**
* Template Name: Attachment Fixing Utility
*/
?>
<html>
<head>
<title>Wordpress Attachments Fixing Utility</title>
<style>
@cdolek
cdolek / innodb_to_myisam.sql
Last active August 29, 2015 14:16
convert innodb to myisam - alter table print
SELECT
CONCAT(
'ALTER TABLE ',
TABLE_SCHEMA,
'.',
TABLE_NAME,
' ENGINE = MyISAM;'
)
FROM
information_schema. TABLES
@cdolek
cdolek / gist:f8952920e53b3cf6ac57
Created March 10, 2015 22:59
wordpress set proper file and folder permissions
# find all files forward this directory and set 644
sudo find . -type f -exec chmod 644 {} +
# find all directories forward and set 755
sudo find . -type d -exec chmod 755 {} +