Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View LeMeteore's full-sized avatar

Nsukami _ LeMeteore

  • Nil
  • Somewhere in the universe
View GitHub Profile
@LeMeteore
LeMeteore / gist:31accdcb701a38ec437aba08e31f8859
Created September 1, 2016 22:20 — forked from atcuno/gist:3425484ac5cce5298932
HowTo: Privacy & Security Conscious Browsing

The purpose of this document is to make recommendations on how to browse in a privacy and security conscious manner. This information is compiled from a number of sources, which are referenced throughout the document, as well as my own experiences with the described technologies.

I welcome contributions and comments on the information contained. Please see the How to Contribute section for information on contributing your own knowledge.

Table of Contents

Types

A type is a collection of possible values. An integer can have values 0, 1, 2, 3, etc.; a boolean can have values true and false. We can imagine any type we like: for example, a HighFive type that allows the values "hi" or 5, but nothing else. It's not a string and it's not an integer; it's its own, separate type.

Statically typed languages constrain variables' types: the programming language might know, for example, that x is an Integer. In that case, the programmer isn't allowed to say x = true; that would be an invalid program. The compiler will refuse to compile it, so we can't even run it.

@LeMeteore
LeMeteore / psqlfix.txt
Created August 12, 2016 12:55
Change postgres default template0 to UTF8 encoding
mike@rbci:~$ psql -U postgres
psql (9.0.3)
Type "help" for help.
postgres=# update pg_database set datallowconn = TRUE where datname = 'template0';
UPDATE 1
postgres=# \c template0
You are now connected to database "template0".
template0=# update pg_database set datistemplate = FALSE where datname = 'template1';
UPDATE 1
#![allow(dead_code)]
use std::fmt::Display;
use std::fmt::Formatter;
use std::fmt::Result;
enum Fzb {
Value(u64),
Fizz(u64),
Buzz(u64),
@LeMeteore
LeMeteore / go-links.md
Created July 19, 2016 00:54 — forked from twotwotwo/go-links.md
Go links
@LeMeteore
LeMeteore / ns-inet.sh
Created July 1, 2016 13:55 — forked from dpino/ns-inet.sh
Setup a network namespace with Internet access
#!/usr/bin/env bash
set -x
NS="ns1"
VETH="veth1"
VPEER="vpeer1"
VETH_ADDR="10.200.1.1"
VPEER_ADDR="10.200.1.2"
@LeMeteore
LeMeteore / kill_thread.c
Created April 16, 2016 16:03 — forked from ymmt2005/kill_thread.c
Kill a specific thread externally by using tgkill(2).
#include <signal.h>
#include <sys/syscall.h> /* For SYS_xxx definitions */
#include <sys/types.h>
#include <unistd.h>
int main() {
pid_t tgid=18456;
pid_t tid=24671;
return syscall(SYS_tgkill, tgid, tid, SIGABRT);
}
@LeMeteore
LeMeteore / ajax_setup.js
Created April 8, 2016 19:20 — forked from rca/ajax_setup.js
Setup Django CSRF token in JQuery AJAX requests
/**
* setup JQuery's AJAX methods to setup CSRF token in the request before sending it off.
* http://stackoverflow.com/questions/5100539/django-csrf-check-failing-with-an-ajax-post-request
*/
function getCookie(name)
{
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
@LeMeteore
LeMeteore / go-pipelines.md
Created April 4, 2016 08:05 — forked from brandur/go-pipelines.md
Go Pipelines

Go Pipelines

This document demonstrates a basic pipeline in Go and talks about a risk in in implementing them. Keep in mind that:

  • Using FizzBuzz here is contrived, but quite a nice way to demonstrate the concept. Obviously there is no advantage to running the basic workload of FizzBuzz in a Goroutine, but if the task involved heavy computation or long lived I/O, it starts to make a lot more sense.
  • The problem discussed only applies to Goroutines that actually need to have a way to