Skip to content

Instantly share code, notes, and snippets.

View n8kowald's full-sized avatar

Nathan n8kowald

  • Australia
  • 15:20 (UTC +09:30)
View GitHub Profile
@n8kowald
n8kowald / gist:2634304
Last active January 31, 2017 15:23 — forked from maciakl/gist:1584387
Git Workflow
# GIT WORKFLOW
# (c) Luke Maciak
# Initialize:
git init
# Check Out:
git clone username@host:/path/to/repository
# Add Origin:
@n8kowald
n8kowald / gist:2634432
Last active June 25, 2021 04:36
Useful SQL Queries
--SQL REPLACING
UPDATE mdl_message SET message = REPLACE(message, "target_view.phpcourse", "target_view.php?course") WHERE message LIKE('%target_view.phpcourse%');
--SQL Backup and Restore
--BACKUP
mysqldump -u root -p[root_password] [database_name] > dumpfilename.sql
--RESTORE
mysql -u root -p[root_password] [database_name] < dumpfilename.sql
--CREATE TABLE
@n8kowald
n8kowald / Useful Unix commands
Last active October 11, 2015 06:38
Useful Unix commands
--- Show numerical permissions ---
ls -l | awk '{k=0;for(i=0;i<=8;i++)k+=((substr($1,i+2,1)~/[rwx]/) \ *2^(8-i));if(k)printf("%0o ",k);print}'
OR THIS
find . -printf "%m:%f\n"
********* .bashrc *********
# Remove CVS directories
alias purgecvs='find . -name CVS -prune -exec rm -rf {} \;'
@n8kowald
n8kowald / gist:4546101
Created January 16, 2013 10:12
Investigate slowness with PHP
$ch = curl_init('http://path/to/sanfrancisco/');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($ch);
$info = curl_getinfo($ch);
$info will return an array including elements for
total_time,
namelookup_time,
connect_time,
pretransfer_time,
@n8kowald
n8kowald / JavaScript Names and Rules
Last active December 11, 2015 05:59
Notes on the name of JavaScript syntax and also rules.
/* RULES */
- Variable and function declarations are hoisted (names are moved to the top of their current scope) by the JavaScript interpreter.
- Variable initialisations are not moved.
- Only functions create new scope
- Function Declarations are officially prohibited within non-function blocks (such as if)
var a; // variable declaration
a = 1; // variable initialisation
@n8kowald
n8kowald / gist:4997158
Created February 20, 2013 17:10
.htaccess - Improve performance by copying and pasting this into your .htaccess (or better yet your VirtualHost config)
# Compress text, html, javascript, css, xml:
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/text
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
@n8kowald
n8kowald / scp-speed-test.sh
Created November 24, 2015 19:11
Test the speed between you and a server
#!/bin/bash
# scp-speed-test.sh
# Author: Alec Jacobson alecjacobsonATgmailDOTcom
#
# Test ssh connection speed by uploading and then downloading a 10000kB test
# file (optionally user-specified size)
#
# Usage:
# ./scp-speed-test.sh user@hostname [test file size in kBs]
#
@n8kowald
n8kowald / date-widget-example.coffee
Created May 26, 2016 11:14
Übersicht date widget example
# This is a simple example Widget, written in CoffeeScript, to get you started
# with Übersicht. For the full documentation please visit:
#
# https://github.com/felixhageloh/uebersicht
#
# You can modify this widget as you see fit, or simply delete this file to
# remove it.
# this is the shell command that gets executed every time this widget refreshes
command: "echo $(whoami) && TZ=Australia/Adelaide date && TZ=Australia/Melbourne date"
@n8kowald
n8kowald / bash-cheatsheet.sh
Created August 28, 2016 19:40 — forked from LeCoupa/bash-cheatsheet.sh
Bash CheatSheet for UNIX Systems
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#
# A little overlook of the Bash basics
#
# Usage:
#
# Author: J. Le Coupanec
# Date: 2014/11/04

Keybase proof

I hereby claim:

  • I am n8kowald on github.
  • I am n8kowald (https://keybase.io/n8kowald) on keybase.
  • I have a public key ASBo4VQ3KwN5Xys75sMXV2ez3KFlkEXdUCT7IjlzZMxYbAo

To claim this, I am signing this object: