Skip to content

Instantly share code, notes, and snippets.

View vidluther's full-sized avatar

Vid Luther vidluther

View GitHub Profile
@vidluther
vidluther / web-servers.md
Created May 13, 2021 23:30 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
Verifying that +vidluther is my openname (Bitcoin username). https://onename.io/vidluther
@vidluther
vidluther / onmetal.json
Created August 27, 2014 14:37
custom role for Rackspace OnMetal/BareMetal servers that chef/ohai don't know how to handle yet.
{
"name": "onmetal",
"description": "Some attributes that are needed when a machine is an 'onmetal' machine from Rackspace",
"json_class": "Chef::Role",
"default_attributes": {},
"override_attributes": {
"openssh": {
"listen_interfaces": {
"bond0.401": "inet"
}
» which gem ◉ ◼◼◼◼◼◼◼◼◻◻
/opt/chefdk/embedded/bin/gem
~ ⮀
» gem list | grep sugar ◉ ◼◼◼◼◼◼◼◻◻◻
chef-sugar (2.1.0)
@vidluther
vidluther / wp_bp_activity.sql
Last active August 29, 2015 13:57
with and without hints
SELECT count(DISTINCT a.id) FROM wp_bp_activity a USE INDEX (type) WHERE a.is_spam = 0 AND a.id IN (957935) AND a.type != 'activity_comment' ORDER BY a.date_recorded DESC
-> ;
+----------------------+
| count(DISTINCT a.id) |
+----------------------+
| 1 |
+----------------------+
1 row in set (2.31 sec)
mysql> SELECT count(DISTINCT a.id) FROM wp_bp_activity a WHERE a.is_spam = 0 AND a.id IN (957935) AND a.type != 'activity_comment' ORDER BY a.date_recorded DESC;
@vidluther
vidluther / bootable_mavericks.bash
Created October 17, 2013 06:46
How to make a bootable USB drive to install OS X Mavericks
sudo ~/Desktop/Install\ OS\ X\ Mavericks.app/Contents/Resources/createinstallmedia \
--volume /Volumes/Empty\ External\ Drive \
--applicationpath /Users/vluther/Desktop/Install\ OS\ X\ Mavericks.app --nointeraction
@vidluther
vidluther / mysqltee.sh
Created April 9, 2013 23:41
Log MySQL Output
mysql> tee sql_log.sql
Logging to file 'sql_log.sql'
mysql> select count(1) from wp_options;
+----------+
| count(1) |
+----------+
| 1792 |
+----------+
1 row in set (0.00 sec)
@vidluther
vidluther / nginx.conf
Created March 24, 2013 02:22
Limit everything except GET requests from the outside world in nginx
location / {
limit_except GET {
deny all;
}
}
@vidluther
vidluther / gist:4732039
Created February 7, 2013 16:18
push changes to remote staging branch
~/work/www.zippykid.com/public/wp-content/themes/zippykid-theme (staging) > git push origin staging
@vidluther
vidluther / s-maintenance-mode.php
Created August 16, 2012 21:49 — forked from mjangda/s-maintenance-mode.php
Custom WordPress maintenance mode that allows super admins access to the Dashboard
<?php
add_action( 'init', 'x_maintenance_mode' );
function x_maintenance_mode() {
if ( defined( 'X_MAINTENANCE_MODE' ) && true === X_MAINTENANCE_MODE ) {
if ( is_super_admin() && is_admin() )
return;
die( 'Site is currently under maintenance' );