Skip to content

Instantly share code, notes, and snippets.

# from http://stackoverflow.com/questions/11476664/easy-way-to-run-explain-on-query-sets-in-django
from django.db import connections
from django.db.models.query import QuerySet
def explain(qs):
cursor = connections[qs.db].cursor()
query, params = qs.query.sql_with_params()
cursor.execute('explain %s' % query, params)
print(qs.query)
print('\n'.join(r[0] for r in cursor.fetchall()))
#!/bin/bash
set -e
: ${IP?Missing desired ip to configure}
: ${HOSTNAME?Missing desired hostname to configure}
: ${ROLE?Missing desired role to configure (master,node)}
: ${NVIDIA?Missing nvidia flag (true,false)}
: ${INGRESS?Missing ingress flag (true,false)}
# Common functions to use in different files

General

datetime (If you want to revert to the hardware clock being in UTC, do:)
timedatectl set-local-rtc 0

Docker

Also making sure we can do docker commands without sudo

yaourt -S --noconfirm docker
usermod -a -G docker $USER
@snelis
snelis / boxstarter
Last active February 10, 2017 11:46
Set-TaskbarOptions -Size Small -Lock -Combine Never
Set-CornerNavigationOptions -DisableUpperRightCornerShowCharms -DisableUpperLeftCornerSwitchApps
Set-WindowsExplorerOptions -EnableShowFileExtensions -EnableShowHiddenFilesFoldersDrives
Enable-RemoteDesktop
Disable-BingSearch
Disable-GameBarTips
choco feature enable -n=allowEmptyChecksums
choco feature enable -n=allowGlobalConfirmation
// Automatically generated configuration file for 'Hyperion daemon'
// Generated by: HyperCon (The Hyperion deamon configuration file builder
{
/// Device configuration contains the following fields:
/// * 'name' : The user friendly name of the device (only used for display purposes)
/// * 'type' : The type of the device or leds (known types for now are 'ws2801', 'ldp8806',
/// 'lpd6803', 'sedu', 'adalight', 'lightpack', 'philipshue', 'test' and 'none')
/// * 'output' : The output specification depends on selected device. This can for example be the
/// device specifier, device serial number, or the output file name
-- Empty tweet table
TRUNCATE TABLE `tweets_feeds`;
-- Empty tweet archive table
TRUNCATE TABLE `tweets_archive`;
-- Empty feeds archive table
TRUNCATE TABLE `predef_archives`
-- Delete all feeds which are archived
@snelis
snelis / football-details-1621945
Created December 7, 2011 09:52
football-details-1621945
"lineup":{
"0":{
"c_Team":"sc Heerenveen",
"c_Person":"Brian Vandenbussche",
"c_Function":"Keeper",
"n_Position":1,
},
"1":{
"c_Team":"sc Heerenveen",
"c_Person":"Daryl Janmaat",
<html xmlns="http://www.w3.org/1999/xhtml"><HEAD><script src="http://openlayers.org/api/OpenLayers.js"></script><meta name="viewport" content="width=device-width, user-scalable=0, minimum-scale=0, maximum-scale=1.0"></HEAD><body><DIV id='map' style='position:absolute; left:0px; top:000px; width:320px; height:415px;'></div><script type="text/javascript">// jsonvar JSON;if(!JSON){JSON={}}(function(){"use strict";function f(n){return n<10?'0'+n:n}if(typeof Date.prototype.toJSON!=='function'){Date.prototype.toJSON=function(key){return isFinite(this.valueOf())?this.getUTCFullYear()+'-'+f(this.getUTCMonth()+1)+'-'+f(this.getUTCDate())+'T'+f(this.getUTCHours())+':'+f(this.getUTCMinutes())+':'+f(this.getUTCSeconds())+'Z':null};String.prototype.toJSON=Number.prototype.toJSON=Boolean.prototype.toJSON=function(key){return this.valueOf()}}var cx=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,escapable=/[\\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5
<html xmlns="http://www.w3.org/1999/xhtml">
<HEAD>
<script src="http://openlayers.org/api/OpenLayers.js"></script>
<meta name="viewport" content="width=device-width, user-scalable=0, minimum-scale=0, maximum-scale=1.0">
</HEAD>
<BODY>
<DIV id='map' style='position:absolute; left:0px; top:000px; width:320px; height:415px;'></div>
{
"delta":1,
"0":{
"n_CompetitionID":11,
"n_CompetitionLevel":0,
"c_Competition":"Vriendschappelijk",
"c_CompetitionShort":"Vriendsch.",
"n_CompetitionNatioGeoID":0,
"c_CompetitionNatio":null,
"c_CompetitionNatioShort":null,