Skip to content

Instantly share code, notes, and snippets.

@jansegre
jansegre / puzzle8.py
Last active October 25, 2018 06:37
8 puzzle game
import math
import random
from enum import Enum, auto
from typing import Iterable, Optional, Set, Tuple, List, Dict
from itertools import chain
#CHAR_CUR = '█'
#CHAR_CUR = '□'
#CHAR_CUR = ' '
CHAR_CUR = '▯'
// cc -shared -fPIC -I/usr/include/python3.5m -O -g -o bar.so bar.c
#include "Python.h"
static PyObject* sum_list(PyObject* self, PyObject* args)
{
Py_ssize_t i, j, n;
long total = 0, value;
PyObject *item;
PyObject *list;
long *values;
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle',
orders: null,
init() {
this.set('orders', this.get('store').findAll('order'));
}
});
@jansegre
jansegre / rust_fib_bench
Last active December 15, 2015 14:50
Small fibonacci bench (Rust, Swift, C)
Fib bench (Rust, Swift, C) I added C to the discussion on
https://www.reddit.com/r/rust/comments/3wxi9x/why_is_rust_much_slower_than_swift_in_this_simple/
@jansegre
jansegre / script.lua
Last active February 10, 2020 23:48
Very basic luajit from Rust.
-- script.lua
-- Receives a table, returns the sum of its components.
io.write("The table the script received has:\n");
x = 0
for i = 1, #foo do
print(i, foo[i])
x = x + foo[i]
end
io.write("Returning data back to C\n");
return x