Skip to content

Instantly share code, notes, and snippets.

View bozbalci's full-sized avatar
🎯
Focusing

Berk Özbalcı bozbalci

🎯
Focusing
View GitHub Profile
@bozbalci
bozbalci / test_similarity.py
Created December 6, 2019 00:45
ceng477 hw2 testing utility
import json
import os
import subprocess
class ComparisonMetric:
AE = 'AE' # absolute error count
DSSIM = 'DSSIM' # structural dissimilarity index
FUZZ = 'FUZZ' # mean color distance
MAE = 'MAE' # mean absolute error
@bozbalci
bozbalci / chess.xml
Created October 29, 2019 17:21
Chess (4K@60fps, 5 sec.)
This file has been truncated, but you can view the full file.
<Scene>
<MaxRecursionDepth>4</MaxRecursionDepth>
<IntersectionTestEpsilon>1e-6</IntersectionTestEpsilon>
<BackgroundColor>0 0 0</BackgroundColor>
<Cameras>
<Camera id="1">
<Position>0.0 15.5 20.0</Position>
<Gaze>-0.0 -0.612571665435814 -0.7904150521752438</Gaze>
<Up>0.0 0.8 -0.6</Up>
<NearPlane>-0.8 0.8 -0.45 0.45</NearPlane>
@bozbalci
bozbalci / ys-select-all-cuisines.user.js
Created September 7, 2019 15:30
Yemeksepeti "Select All Cuisines"
// ==UserScript==
// @name Select All Kitchens
// @namespace https://www.yemeksepeti.com/
// @version 0.1.0
// @description Adds a "Select All" menu to the Yemeksepeti kitchen selection pop-up.
// @author bozbalci
// @match https://www.yemeksepeti.com/
// @include /^https?://www\.yemeksepeti\.(com)/.*
// @run-at document-end
// @grant none
@bozbalci
bozbalci / schema.py
Created July 9, 2019 08:46
assortment of python hacks
from pprint import pprint
def even_to_true(n):
return n % 2 == 0
def validate_schema(schema, data):
if not (isinstance(schema, dict) and isinstance(data, dict)):
raise Exception("both schema and data must be dicts")
@bozbalci
bozbalci / stress.ast
Last active January 14, 2019 18:00
XPLN Stress Test
fun alotofarguments
args
arg a
arg b
arg c
arg d
arg e
arg f
arg g
arg h
@bozbalci
bozbalci / oddity.py
Created May 14, 2018 20:43
Space Oddity?
M=type('',(type,),{'__new__':lambda _,__,___,
____:type.__new__(_,__,___,{**____,'__add__':
lambda _____,______:len(__).__mul__(len(___))
.__add__(______())})});_=type('',(),{"""__g\
etattribute__""":lambda _,__:lambda:type('',(
),{})})();__=lambda x: x.__code__.co_argcount
___=lambda*C:print(''.join(chr(c()+c()) for c
# I'd obfuscate my code in Python rather than
in C))
class __________(
(lambda L,G,_,S,d,g,e,I,M,C,i,j, __,___,____,_____,______,_______,
________,_________,__________, ___________,____________,
_____________,______________, _______________,________________:
(lambda s:(G(I(s(L((L((_____, _____________,)),L((______,
___________,)),)))),s(L((L(( _______,_________,)),L((____,
_____,__________,)),L((_____, ______,_______,)),L((____,____,
____________,)),L(( _______________,)),))))(___,G(S,s
(L((L((_______________,)),L(( ____,______,________,)),L((_____,
_____,________,)),L((_____, _____________,)),L((____,____,
______,______,)),L(( _______________,)),))))(s(L((L((
@bozbalci
bozbalci / hack.c
Created February 16, 2018 09:56
Creating a C function on-the-fly
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <unistd.h>
int (*create_adder(int add_what))(int)
{
char *p = mmap(NULL, 4096, PROT_READ | PROT_WRITE | PROT_EXEC,
MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
@bozbalci
bozbalci / crimson.Xresources
Created January 18, 2018 21:25
Crimson terminal colorscheme
#define base00 #100104
! #define base01 #26030A
#define base01 #ff1745
#define base02 #450613
#define base03 #520716
#define base04 #ab0f2f
#define base05 #b91132
#define base06 #e3143e
#define base07 #f71643
#define base08 #7c0b22
@bozbalci
bozbalci / genborder.py
Created January 18, 2018 21:22
Generates a simple XFWM4 theme
active_targets = [
"bottom-active.xpm",
"bottom-left-active.xpm",
"bottom-right-active.xpm",
"left-active.xpm",
"right-active.xpm",
"title-1-active.xpm",
"title-2-active.xpm",
"title-3-active.xpm",
"title-4-active.xpm",