Skip to content

Instantly share code, notes, and snippets.

from hashlib import sha512
import Image
import numpy as np
def chunks(l, n):
return [l[i:i+n] for i in range(0, len(l), n)]
word_list = open("words.txt", "r").read().split()
for word in word_list:
data_string = "hello world"
hash = sha512(data_string).digest()
@kylelk
kylelk / highlight.py
Created January 28, 2014 03:34
Create highlighted listings of files
# -*- coding: utf-8 -*-
import pygments
from pygments import highlight
from pygments.lexers import get_lexer_by_name
from pygments.formatters import HtmlFormatter
from pygments.lexers import guess_lexer, get_lexer_for_filename
from os import listdir, mkdir
from os.path import isfile, join, getsize, getctime, isdir, dirname, abspath
from time import ctime
import glob

An experiment within the Visualisation Exploration series.

Exploring, techniques and practices in the field of data visualisation.

Key history of this experiment:

  • D3, the data driven visualisation enabler.
  • Initial prototype written in handcrafted SVG with handcrafted data
  • Creation of sample .json dataset
  • Migration to systematic data treatment using D3
<!--
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@kylelk
kylelk / texteditor_last_err.log
Created January 25, 2014 06:30
Android created Gist
FINGERPRINT=acer/a100_pa_cus1/vangogh:4.0.3/IML74K/1374574145:user/release-keys
HARDWARE=vangogh
SKU=PA_CUS1
UNKNOWN=unknown
RADIO=unknown
BOARD=vangogh
PRODUCT=a100_pa_cus1
DISPLAY=Acer_AV041_A100_1.049.00_PA_CUS1
USER=pandora
HOST=pandora08
#include <stdio.h>
int gcd( int a, int b ) {
int result ;
/* Compute Greatest Common Divisor using Euclid's Algorithm */
__asm__ __volatile__ ( "movl %1, %%eax;"
"movl %2, %%ebx;"
"CONTD: cmpl $0, %%ebx;"
"je DONE;"
"xorl %%edx, %%edx;"
@kylelk
kylelk / content
Created January 20, 2014 21:53
C formated timestamp
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main()
{
time_t timer;
char buffer[25];
struct tm* tm_info;
#include <unistd.h>
#include <sys/types.h>
#include <dirent.h>
#include <stdio.h>
#include <string.h>
void listdir(const char *name, int level)
{
DIR *dir;
struct dirent *entry;
from os import urandom
from hashlib import sha1
import time
def mint(name, bits):
t = time.strftime("%y%m%d")
out = " "
count = 0
while out[:bits] != bits*"0":
RandomData = urandom(8).encode("base64").replace("\n", "")
#include <stdio.h>
#include <stdlib.h>
struct IntegerVar {
unsigned char *n1;
unsigned char *n2;
};
int main()
{