Skip to content

Instantly share code, notes, and snippets.

View johnsyweb's full-sized avatar

Pete Johns johnsyweb

View GitHub Profile
Page 1
Transcript of Live Chat
A transcript of this secure Chat is retained and may be monitored for coaching purposes. You can view our Privacy Statement at telstra.com.
Please select 'End chat' if you do not wish to proceed.
Maria Cristina
Hi PETER, how may I help you?
iex(2)> v()
1: h()
#=> :"do not show this result in output"
:ok
#!/usr/bin/env ruby
# encoding: utf-8
IDEAS = [
%Q(Bar uvg jbaqref' bgure fbatf),
%Q(Gurl jnag gb oernx serr: Gur zhfvp gurl znqr jura gurl yrsg gur onaq),
%Q(Nhfgenyvnan: Fubjpnfr lbhe snibhevgr angvir onaqf gb arjpbzref gb guvf ynaq tveg ol frn ),
%Q(Sbervta ynathntr fbatf),
%Q(Xrrc ba Ehaava': Zhfvp gb zbgvingr zr gb trg cnfg gur 8xz znex),
%Q(Zhfvp bs gur zbivrf: Abg gur gurzrf… ohg fbatf znqr snzbhf ol gur zbivrf),
#!/bin/bash
boot2docker down
for i in {49000..49900}; do
for protocol in 'tcp' 'udp'; do
VBoxManage modifyvm "boot2docker-vm" --natpf1 "${protocol}-port${i},${protocol},,${i},,${i}"
done
done
@johnsyweb
johnsyweb / broken-git
Created August 5, 2014 05:21
Oh. Great(!)
$ git fetch
remote: Counting objects: 4467, done.
remote: Compressing objects: 100% (2616/2616), done.
remote: Total 4467 (delta 2569), reused 2859 (delta 1665)
Receiving objects: 100% (4467/4467), 3.87 MiB, done.
Resolving deltas: 100% (2569/2569), done.
fatal: bad object 932319fa81372b23ab80b4fd8c99947b83322f3c
def binary_search(elements, required):
if 1 == len(elements):
if required == elements[0]:
return required
else:
return None
else:
midpoint = int(len(elements) / 2)
if elements[midpoint] > required:
return binary_search(elements[:midpoint], required)
#include <iostream>
#include <fstream>
class scoped_cout_redirector
{
public:
scoped_cout_redirector(const std::string& filename)
:backup_(std::cout.rdbuf())
,filestr_(filename.c_str())
,sbuf_(filestr_.rdbuf())
@johnsyweb
johnsyweb / lie.cpp
Created February 5, 2013 08:41
Comments are lies!
// --------------------------------------------------------------------------
// Method Name: CProtocolField::setValue
// Definition: This method sets the value attribute of the CProtocolField.
// Qualification: none
// Export: public
//
// Return: void
// Parameters: double value
//
// Preconditions: none
@johnsyweb
johnsyweb / noise.cpp
Created February 5, 2013 08:47
Comments are noise!
//////////////////////////////////////////////////////////////////////////////
//
// Function Name: ExcCxlCached::~ExcCxlCached()
//
// Definition: Destructor for the ExcCxlCached class
//
// Qualification: virtual
//
// Export: public
//
@johnsyweb
johnsyweb / mtr --report github.com.md
Last active December 16, 2015 08:48
10% packet loss in rackspace.

From Work [115.146.71.1]

[Fri 13/05/10 08:14 EST][s009][x86_64/darwin12.2.0/12.3.0][5.0.2]
<paj@pajimac:~>
zsh 3013 % mtr --report github.com
HOST: pajimac.local               Loss%   Snt   Last   Avg  Best  Wrst StDev
  1.|-- 192.168.0.1                0.0%    10    5.2   4.2   3.3   5.2   0.7
  2.|-- lo-1-pe1-mel-dc2.firenet.  0.0%    10    2.5   3.0   2.3   5.2   0.9
  3.|-- ge-0-0-0-bdr1-mel-dc2.fir  0.0%    10    5.2  10.8   4.4  60.5  17.5