Skip to content

Instantly share code, notes, and snippets.

Oliver Wright meiamsome

Block or report user

Report or block meiamsome

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@meiamsome
meiamsome / loadmnist.js
Last active Aug 22, 2018
mnist_loader.js
View loadmnist.js
let mnist = {};
let files = {
trainingImages: 'train-images.idx3-ubyte',
trainingLabels: 'train-labels.idx1-ubyte',
t10kImages: 't10k-images.idx3-ubyte',
t10kLabels: 't10k-labels.idx1-ubyte',
}
function loadMnist() {
View gist:66fb02fb09433686b7624b6f5d42e828
{
"PL": {
"Belsk": {
"IGFPAN": 1
},
"Siedlce": {
"Konarskiego": 3
},
"Radom": {
"Tochtermana": 4
@meiamsome
meiamsome / Duplicate_with_different_coords.json
Last active Jul 5, 2017
List of locations that have the same name
View Duplicate_with_different_coords.json
[
{
"name": "Buffalo",
"cities": "Davenport-Moline-Rock Island,Buffalo-Niagara Falls",
"latitudes": "41.4672010,42.8781000",
"longitudes": "-90.6883010,-78.8094000"
},
{
"name": "CENTRO",
"cities": "CCAA Andaluc\ufffda,Ayto Zaragoza",
View Rust Prime Sieve SIGFPE
use std::cmp;
use std::fs;
extern "C" {
fn signal(sig: u32, cb: extern fn(u32)) -> fn(u32);
}
extern fn interrupt(_:u32) {
panic!();
}
@meiamsome
meiamsome / taran.py
Created Oct 27, 2016
Formats Premier Shortcuts as per Taran's video
View taran.py
# Script to process file as per https://www.youtube.com/watch?v=gF-f25dRbo8
# Outputs to test.txt by default.
# Inputs as files on command line
import fileinput
if __name__ == "__main__":
output = 'test.txt'
with open(output, 'w') as f:
f.writelines(list(name + "&" + key.replace('+',' ') + "\n" for name, *keys in (line.strip().split('\t') for line in fileinput.input()) for key in keys))
@meiamsome
meiamsome / bf.py
Created Aug 3, 2016
Brainfuck interpreter in a single Python statement (No eval, double sided 'infinite' tape, no number limit in a cell). First lambda function is the entire interpreter, arguments are program (as a string), input and output (as files, already open)
View bf.py
list(((lambda program, input_stream, output_stream, instruction_stack=[], count=[]:
(lambda instruction_queue=[0], program_stack=[], program_memory=[0], pointer=[0],
instructions=[
(count.append(0) or len(count) - 1, len(instruction_stack), x, instruction_stack.append([len(count)]) or instruction_stack[-1]) if x == '['
else (
(count.append(0) or len(count) - 1, len(instruction_stack), x, instruction_stack[-1].append(len(count)) or [instruction_stack.pop()[0],len(count)])if x == ']'
else (count.append(0) or len(count) - 1, len(instruction_stack), x, [len(count)]*2
)
) for x in program]:
(
@meiamsome
meiamsome / example.js
Last active Jun 19, 2016
Allows creation of a value that can be transitioned with CSS 3 transitions.
View example.js
// Create a number that takes 100s to transition after a 1s delay with an ease-in-out
test_number = new transitioned_variable(0, "100s", "ease-in-out", "1s");
// Create a color with a 100s transition, and no set easing or delay
test_color = new transitioned_variable("#000", "100s", undefined, undefined, transitioned_variable.TYPE_COLOR);
// Bouncy transition
test_bounce = new transitioned_variable(0, "5s", "ease-in-out");
// After a second, alter our values
setTimeout(function(){
test_number.set(100);
View inverse.c
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
size_t width, height;
double data[];
} matrix;
@meiamsome
meiamsome / hn_search.js
Last active Jun 1, 2018 — forked from kristopolous/hn_seach.js
hn job query search
View hn_search.js
/* Hacker News Search Script
*
* Original Script by Kristopolous:
* https://gist.github.com/kristopolous/19260ae54967c2219da8
*
* Usage:
* First, copy the script into your browser's console whilst on the Hacker News
* jobs page. Then, you can use the query function to filter the results.
*
* For example,
You can’t perform that action at this time.