Skip to content

Instantly share code, notes, and snippets.

@sakekasi
sakekasi / hyper.js
Created February 10, 2021 18:57
hyper.js
// Future versions of Hyper may add additional config options,
// which will not automatically be merged into this file.
// See https://hyper.is#cfg for all currently supported options.
module.exports = {
config: {
// choose either `'stable'` for receiving highly polished,
// or `'canary'` for less polished but more frequent updates
updateChannel: 'stable',
@sakekasi
sakekasi / main.py
Last active December 4, 2017 19:03
mit problem 2
# Implement a function that meets the specifications below.
def deep_reverse(L):
"""
assumes L is a list of lists whose elements are ints.
returns a new list that reverses L's elements and also
reverses the order of the int elements in every element of L.
"""
# Your code here
pass
@sakekasi
sakekasi / main.py
Last active December 3, 2017 02:03
mystery 2
def mystery2(lst, n):
if n == 0:
return lst
elif lst == []:
return lst
else:
a = mystery2(lst[1:], n-1)
b = a[0:n-1]
c = a[n-1:]
return b + [lst[0]] + c
@sakekasi
sakekasi / main.py
Last active November 20, 2017 06:45
Sum Numbers Problem Description
start = 1
end = 10
sum = 0 # sum should be 55
# set sum to the sum of all numbers from 1 to 10
# Your code goes here
@sakekasi
sakekasi / main.py
Created November 20, 2017 06:22
Closest Power Problem Description
def closest_power(base, num):
'''
base: base of the exponential, integer > 1
num: number you want to be closest to, integer > 0
Find the integer exponent such that base**exponent is closest to num.
Note that the base**exponent may be either greater or smaller than num.
In case of a tie, return the smaller value.
Returns the exponent.
'''
# your code goes here
@sakekasi
sakekasi / main.py
Created November 20, 2017 06:19
mystery
def mystery(lst, n):
if n == 0:
return lst
elif lst == []:
return lst
else:
return mystery(lst[1:], n-1) + [lst[0]]
ans = mystery([1,3,4,7,9], 2)
@sakekasi
sakekasi / CNF.js
Last active May 7, 2017 17:59
An implementation of directed resolution for CNF knowledge bases
class Literal {
constructor(variable, same) {
this.variable = variable;
this.same = same;
}
equal(other) {
return other instanceof Literal &&
other.variable === this.variable &&
other.same === this.same;
@sakekasi
sakekasi / read-command.c
Last active December 24, 2015 18:59
my code
//command stack. used to store operands
typedef struct cmd_stk
{
command_t *stack;
unsigned cap;
unsigned index;
}cmd_stk_t;
static cmd_stk_t*
make_cmd_stk(unsigned cap)
@sakekasi
sakekasi / errors
Created November 12, 2012 04:18
error messages from -Wall -pedantic
g++ gtk-floodit-board.cc -fPIC -c -O -o gtk-floodit-board.o `pkg-config gtkmm-3.0 cairomm-1.0 --cflags` `pkg-config gtkmm-3.0 cairomm-1.0 --libs` -Wall -pedantic
gtk-floodit-board.cc: In constructor 'GtkFlooditBoard::GtkFlooditBoard()':
gtk-floodit-board.cc:15:64: warning: base 'Gtk::DrawingArea' will be initialized after [-Wreorder]
gtk-floodit-board.cc:15:64: warning: base 'FlooditBoard' [-Wreorder]
gtk-floodit-board.cc:14:1: warning: when initialized here [-Wreorder]
gtk-floodit-board.cc: In constructor 'GtkFlooditBoard::GtkFlooditBoard(FlooditBoard*)':
gtk-floodit-board.cc:29:27: warning: delegating constructors only available with -std=c++11 or -std=gnu++11 [enabled by default]
g++ floodit-board.cc -fPIC -c -O -o floodit-board.o -Wall -pedantic
floodit-board.cc: In member function 'color FlooditBoard::set_color(int, int, color)':
floodit-board.cc:106:1: warning: no return statement in function returning non-void [-Wreturn-type]
@sakekasi
sakekasi / backtrace.txt
Created August 29, 2012 00:09
Backtrace for game of life
#0 0x00007ffff7bd5e0c in GameOfLife::cells_get(int, int) () from libgame-of-life.so
#1 0x00007ffff7bd5e65 in GameOfLife::create_updated_grid() () from libgame-of-life.so
#2 0x00007ffff7bd5fb5 in GameOfLife::tick() () from libgame-of-life.so
#3 0x00007ffff7bd6af8 in sigc::adaptor_functor<sigc::bound_mem_functor0<bool, GameOfLife> >::operator()() const () from libgame-of-life.so
#4 0x00007ffff7bd6b0a in sigc::internal::slot_call0<sigc::bound_mem_functor0<bool, GameOfLife>, bool>::call_it(sigc::internal::slot_rep*) () from libgame-of-life.so
#5 0x00007ffff62434f2 in ?? () from /lib/libglibmm-2.4.so.1
#6 0x00007ffff4e9800b in ?? () from /lib/libglib-2.0.so.0
#7 0x00007ffff4e97475 in g_main_context_dispatch () from /lib/libglib-2.0.so.0
#8 0x00007ffff4e977a8 in ?? () from /lib/libglib-2.0.so.0
#9 0x00007ffff4e97ba2 in g_main_loop_run () from /lib/libglib-2.0.so.0