This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/crystalize.py b/crystalize.py | |
index 8f85408..d53a4ac 100755 | |
--- a/crystalize.py | |
+++ b/crystalize.py | |
@@ -76,7 +76,7 @@ code = [] | |
keywords = 'alias and begin break case class def defined do else elsif end ensure false for if in module next nil not or redo rescue retry return self super then true undef unless until when while yield BEGIN END'.split() | |
-lib_name = 'Lib' | |
+lib_name = 'PCRE' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
lib CP | |
fun message = "cpMessage"(condition : UInt8*, file : UInt8*, line : Int32, is_error : Int32, is_hard_error : Int32, message : UInt8*, ...) : Void | |
alias Float = Float64 | |
alias HashValue = LibC::SizeT | |
alias CollisionID = UInt32 | |
alias Bool = UInt8 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python3 | |
import subprocess | |
import re | |
#repl = {6:2, 7:2} # Mouse buttons to be replaced | |
repl = {6:8, 7:9} # Mouse buttons to be replaced | |
out = subprocess.check_output(['xinput', 'list']) | |
for s in out.decode('utf-8').lower().split('\n'): | |
try: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%if False: | |
print(5) | |
print("a") | |
print("lol") | |
for i in range(10): | |
%if True: | |
print(6) | |
print(8) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dbus | |
bus = dbus.SessionBus() | |
proxy = bus.get_object("org.freedesktop.Notifications", "/org/freedesktop/Notifications") | |
proxy.Notify("app", dbus.UInt32(0), "", "title", "body", dbus.Array([], signature="s"), dbus.Dictionary({}, signature="sv"), 1000) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Generator functions in Python give out results one by one, and you can iterate over them in a for-loop | |
def tokens_generator(): | |
yield "{" | |
yield "Hash" | |
yield "(" | |
yield "Int32" | |
yield "," | |
yield "Array" | |
yield "(" | |
yield "Int32" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <vector> | |
#include <cmath> | |
#include <SFML/Graphics.hpp> | |
#include "roundendedline.hpp" | |
int main() { | |
sf::Vector2f cross[][2] = { |
- Array
- Deque (circular buffer)
- crystalline Deque (linked list)
crystal run --release bm.cr
class | unshift pop unshift | push shift push | push pop | unshift shift | each | insert length/8 | insert length*3/5 |
---|---|---|---|---|---|---|---|
array | 1.405377 | 0.685335 | 0.015142 | 7.018896 | 0.000162 | 0.222118 | 0.101504 |
deque | 0.000901 | 0.000897 | 0.021794 | 0.019965 | 0.000303 | 0.151282 | 0.301467 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Indexable(T) | |
def threadpool_map(workers : Int = 8, chunk_size : Int? = nil, &func : T -> R) forall T, R | |
mutex = Thread::Mutex.new | |
cs = chunk_size || (self.size**0.5).ceil.to_i | |
Array(R).build(self.size) do |result| | |
index = 0 | |
threads = Array.new(workers) { | |
Thread.new do | |
a = b = 0 | |
loop do |