Skip to content

Instantly share code, notes, and snippets.

Magic

  • magic works by True Words, an Ancient Language, etc.
  • magic is hereditary

Elves

  • elves are extra-special
  • elves are white, hairless, delicate, beautiful
  • elves are master archers and mages
@nyux
nyux / markov.py
Last active January 1, 2016 13:58
import random
import argparse
import os.path
import re
class MarkovChain:
def __init__(self, len_output, files):
self.units = self.process(files)
self.num_units = len(self.units)
self.len_output = len_output
import math
precision = input('Enter a positive number to specify how sophisticated'
'and precise our approximation should be: ')
precision = int(precision)
if precision < 0:
print("You gave me bad input. Try again.")
exit()
from math import factorial as f
from math import e as thingy
p = int(input('pos number'))
#error
if p < 0:
print('no')
exit()
#sum
@nyux
nyux / gist:5504563
Last active December 16, 2015 22:09
[Unit]
Description=Allow user to modify keyboard brightness
After=sys-kernel-debug.mount
After=systemd-sysctl.service
After=slim.service
[Service]
Type=oneshot
ExecStart=/usr/bin/chmod 666 /sys/devices/platform/samsung/leds/samsung::kbd_backlight/brightness
patching file Makefile
patching file Makefile
g++ -g -std=c++11 -c -o ../HGScripting.o ../HGScripting.cpp -Ilibs/include -I.. -I../SSVStart -I../SSVEntitySystem -I../SSVMenuSystem -I../SSVLuaWrapper
In file included from ../SSVLuaWrapper/SSVLuaWrapper.h:1:0,
from ../HexagonGame.h:26,
from ../HGScripting.cpp:8:
../SSVLuaWrapper/LuaContext.h: In instantiation of ‘static int Lua::LuaContext::_push(T, decltype (& T:: operator()))::Callback::call(lua_State*) [with T = hg::HexagonGame::initLua()::__lambda6; lua_State = lua_State]’:
../SSVLuaWrapper/LuaContext.h:544:3: required from ‘int Lua::LuaContext::_push(T, decltype (& T:: operator())) [with T = hg::HexagonGame::initLua()::__lambda6; decltype (& T:: operator()) = void (hg::HexagonGame::initLua()::__lambda6::*)(std::basic_string<char>)const]’
../SSVLuaWrapper/LuaContext.h:151:54: required from ‘void Lua::LuaContext::writeVariable(const string&, T&&) [with T = hg::HexagonGame::initLua()::__lambda6; std::string = std::basic_s
@nyux
nyux / gist:5406052
Last active December 16, 2015 08:29
from math import factorial as f
from math import e as thingy
def a(i):
s = 1
for i in range(i):
s += 1/f(i)
return s
@nyux
nyux / Picture.py
Last active December 15, 2015 20:49
from tkinter import Tk, Canvas, PhotoImage, mainloop, Toplevel
firsttime = True
class Picture:
def __init__(self, path):
global firsttime
if firsttime:
self.window = Tk()
[12:32:36][nyux@noxya][~]$ lspci -vnn
00:00.0 Host bridge [0600]: Intel Corporation 2nd Generation Core Processor Family DRAM Controller [8086:0104] (rev 09)
Subsystem: Samsung Electronics Co Ltd Device [144d:c0d3]
Flags: bus master, fast devsel, latency 0
Capabilities: <access denied>
00:02.0 VGA compatible controller [0300]: Intel Corporation 2nd Generation Core Processor Family Integrated Graphics Controller [8086:0116] (rev 09) (prog-if 00 [VGA controller])
Subsystem: Samsung Electronics Co Ltd Device [144d:c0d3]
Flags: bus master, fast devsel, latency 0, IRQ 50
Memory at f0000000 (64-bit, non-prefetchable) [size=4M]
@nyux
nyux / timing.py
Last active December 15, 2015 05:19
import timeit
# Going by Wolfram Alpha's definition, where fib(1) = fib(2) = 1
# and disregarding zero or the negative numbers completely.
def rfib(n):
if n <= 2:
return 1
else: