Skip to content

Instantly share code, notes, and snippets.

Avatar

Rahmin Pavlovic rpavlovic

  • Ernst & Young
  • NYC
View GitHub Profile
@rpavlovic
rpavlovic / create_time_zone.sql
Created Feb 15, 2015
Create Time Zone Tables
View create_time_zone.sql
CREATE TABLE `time_zone` (
`Time_zone_id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`Use_leap_seconds` enum('Y','N') NOT NULL DEFAULT 'N',
PRIMARY KEY (`Time_zone_id`)
) ENGINE=MyISAM AUTO_INCREMENT=1676 DEFAULT CHARSET=utf8 COMMENT='Time zones';
CREATE TABLE `time_zone_leap_second` (
`Transition_time` bigint(20) NOT NULL,
`Correction` int(11) NOT NULL,
PRIMARY KEY (`Transition_time`)
@rpavlovic
rpavlovic / recommended_innodb.sql
Last active Sep 8, 2015
Query to recommended InnoDB buffer pool
View recommended_innodb.sql
View git-fork-sync
#!/bin/bash
usage() {
echo "$0 usage:"
echo ""
echo " $0 [options]"
echo ""
echo "Where [options] include:"
echo ""
echo " -h|--help Show this help"
@rpavlovic
rpavlovic / server.js
Created Feb 12, 2015
simple Node.js server
View server.js
// A very basic web server in node.js
// Stolen from: Node.js for Front-End Developers by Garann Means (p. 9-10)
var port = 8000;
var serverUrl = "127.0.0.1";
var http = require("http");
var path = require("path");
var fs = require("fs");
@rpavlovic
rpavlovic / search_zip_files.sh
Created Feb 2, 2015
search directory of .zip files for file(s) containing text
View search_zip_files.sh
#!/bin/bash
for file in *.zip; do unzip -c "$file" | grep "text to find" && echo $f;
@rpavlovic
rpavlovic / list_props.js
Created Jan 31, 2015
Use JavaScript to list any/all properties of any JS object (native or custom)
View list_props.js
/*
Each browser/device has their set of JS properties (some more secret than others)
Use JavaScript to list any/all properties of any JS object (native or custom)
An old method of mine from the "browser wars"
*/
var logger = logger || {
getProperties : function(obj) {
var props = [];
for(var n in obj) {
var prop = obj.toString() + "." + n;
@rpavlovic
rpavlovic / wp_average_comments.sql
Created Jan 29, 2015
Wordpress SQL: average comments per day over time
View wp_average_comments.sql
SELECT
'2010-11-24' AS date_begin,
'2015-01-26' AS date_end,
day_of_week,
AVG(comment_count) AS average_comments
FROM (
SELECT
comment_date,
DAYNAME(comment_date) day_of_week,
DAYOFWEEK(comment_date) day_num,
You can’t perform that action at this time.