Skip to content

Instantly share code, notes, and snippets.

View meiamsome's full-sized avatar

Oliver Wright meiamsome

View GitHub Profile
@meiamsome
meiamsome / hn_search.js
Last active May 4, 2022 13:23 — forked from kristopolous/hn_seach.js
hn job query search
/* 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,
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
typedef struct {
size_t width, height;
double data[];
} matrix;
@meiamsome
meiamsome / example.js
Last active June 19, 2016 17:03
Allows creation of a value that can be transitioned with CSS 3 transitions.
// 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);
@meiamsome
meiamsome / bf.py
Created August 3, 2016 13:30
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)
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 / taran.py
Created October 27, 2016 10:56
Formats Premier Shortcuts as per Taran's video
# 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))
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 / Duplicate_with_different_coords.json
Last active July 5, 2017 20:29
List of locations that have the same name
[
{
"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",
{
"PL": {
"Belsk": {
"IGFPAN": 1
},
"Siedlce": {
"Konarskiego": 3
},
"Radom": {
"Tochtermana": 4
@meiamsome
meiamsome / loadmnist.js
Last active July 21, 2020 12:19
mnist_loader.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() {