Skip to content

Instantly share code, notes, and snippets.

Avatar

Mat Gadd Drarok

View GitHub Profile
View example.json
{
"see": "this is still accessible"
}
View keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@Drarok
Drarok / gist:7b2fb47658f6869eb8a1
Created Jan 26, 2015
Pragma-style markers in Swift
View gist:7b2fb47658f6869eb8a1
// MARK: - Section1
func section1Method0() {
}
// MARK: Test1-1
func section1Method1() {
}
// MARK: Test1-2
func section1Method2() {
View gist:ea9bff32903103a65043
<?php
function csv_to_array($filename='/root/samhodson/nagios-dev.csv', $delimiter=',', $enclosure = '"')
{
if(!file_exists($filename) || !is_readable($filename)) echo "neg";
return FALSE;
$header = NULL;
$data = array();
if (($handle = fopen($filename, 'r')) !== FALSE)
View gist:73301886f000cac677cc
<?php
$username = 'trololololol';
$password = 'trololololol';
$url = 'http://some-project.localdev/';
// Set some curl options.
$ch = curl_init();
curl_setopt_array($ch, array(
View gist:8259d275f39c22eedb68
SELECT
ServerObject.Name,
storageYesterday.Committed AS committedYesterday,
storageToday.Committed AS committedToday,
ROUND((storageToday.Committed - storageYesterday.Committed) / 1073741824) AS DifferenceGB
FROM
ServerObject
LEFT OUTER JOIN
StorageUsedByVm AS storageYesterday ON
storageYesterday.VcenterId = ServerObject.VcenterId
View pr-merged.sh
#!/bin/bash
# PR been merged on github? This will checkout $1 || develop, git pull, and then delete the branch you were on.
# Thanks http://stackoverflow.com/a/1593487/328817
branch_name="$(git symbolic-ref HEAD 2>/dev/null)" || branch_name="(unnamed branch)"; # detached HEAD
branch_name=${branch_name##refs/heads/};
if [ "$branch_name" = "develop" ] || [ "$branch_name" = "master" ]
then
View useGitUrl.sh
#!/bin/bash
# Convert 'http://github.com/user/repo' remotes to 'git://github.coim/user/repo'.
for GIT_DIR in $(find . -type d -name '.git'); do
export GIT_DIR
CURRENT_URL=$(git config --get remote.origin.url);
NEW_URL=$(echo $CURRENT_URL | sed 's/^http:/git:/');
NEW_URL=$(echo $NEW_URL | sed 's/^https:/git:/');
if [ "$CURRENT_URL" != "$NEW_URL" ]; then
@Drarok
Drarok / gist.php
Last active Jan 2, 2016 — forked from anonymous/gist:8218272
Converted example to use PDO.
View gist.php
<?php
$dsn = 'mysql:host=trolololol;dbname=WOOT!';
$username = 'yeah';
$password = 'MMMMM hmm';
$pdo = new PDO($dsn, $username, $password);
$sql = 'SELECT `date`, SUM(`Commited`) AS committedSum FROM StorageUsedByVm GROUP BY `date`';
$stmt = $pdo->query($sql);
View gist:5958827
| (• ◡•)|/ \(❍ᴥ❍ʋ) Adventure Time!