View byte_slice_of_ints.go
package main
import (
"crypto/rand"
"encoding/binary"
"fmt"
)
func main() {
View shared_atomic_increments.go
package main
import (
"fmt"
"sync/atomic"
"time"
)
type Foo struct {
I *int64
View dnsmasq.md

DNSMasq

Ubuntu 12.04LTS and above by default runs their own instance of Dnsmasq via the NetworkManager service.

Don't do this

Install dnsmasq to cache DNS queries

sudo apt-get install dnsmasq
View README.md

Using Dnsmasq with Ubuntu for VM web application testing

When running virtual machines under a Linux host system for testing web apps in various browsers (e.g. Internet Explorer), I found it rather tedious having to continually tweak the hosts file within each VM for the purpose of adding entries pointing back to the host machine's development web server address.

Instead the steps below will setup Dnsmasq on a Ubuntu 16.04LTS, 14.04LTS or 12.04LTS host machine for the purpose of serving both it's own DNS queries and that of virtual machine guests. Dnsmasq will parse the /etc/hosts file on your host machine where we will keep a single set of DNS entires to our test web application(s).

View translate.go
// Traverses an arbitrary struct and translates all stings it encounters
//
// I haven't seen an example for reflection traversing an arbitrary struct, so
// I want to share this with you. If you encounter any bugs or want to see
// another example please comment.
//
// The MIT License (MIT)
//
// Copyright (c) 2014 Heye Vöcking
//
View parse_struct_fields.go
package main
import (
"fmt"
"reflect"
)
type MultiQuestions struct {
QuestionId int64
QuestionType string
View timeit.js
// https://nodejs.org/docs/v0.8.0/api/all.html#all_process_hrtime
const timeitnode = function (name) {
const start = process.hrtime();
return {
stop() {
const diff = process.hrtime(start);
console.log('"%s" took %d seconds and %d nanoseconds', name, diff[0], diff[1]);
// return process.hrtime(start);
},
View setup_android.md

Download Android Studio

Install

  • NDK
  • LLDB
  • An Emulator of your choice (Android v1-9)

Add the following lines to the end of ~/.bashrc or ~/.zshrc (if using Oh My ZSH):

View catch_lines.js
function foo() { try { Math.ciel(foo); } catch (e) { console.log(e.stack.match(/\n\s+at \S+:\d/g)); } } function bar() { foo(); } bar();
View DNSMasq_withMalwareBlocking.md

Assuming a Properly configured DNSMasq

a quickstart for dnsmasq is given at the end if you have not set it up yet.

something like this will add a great regularly updated malware file for it to use. More security and privacy to you! Specifically, this uses https://github.com/StevenBlack/hosts Choose one of the Raw Hosts file from there to use.

To setup DNSMasq, follow the below ...

wget -O- https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts | awk '$1 == "0.0.0.0" { print "address=/"$2"/0.0.0.0/"}' > /etc/dnsmasq.d/malware.conf`