Skip to content

Instantly share code, notes, and snippets.

@t184256
t184256 / python_shatters_logic
Created April 26, 2014 14:13
python shatters my logic
#!/usr/bin/python
a = 'sooner'
def parent_func():
print a
# Guess what uncommenting the line below would change?
#a = 'parent'
return a
@t184256
t184256 / forcecrc32.py
Created May 7, 2015 15:26
danilka_cracker
#
# CRC-32 forcer
#
# Copyright (c) 2014 Project Nayuki
# All rights reserved. Contact Nayuki for licensing.
# http://www.nayuki.io/page/forcing-a-files-crc-to-any-value
#
import os, sys, zlib
#!/usr/bin/python
# Given the resolution and diagonal, calculate the mm size of the screen and the ppi
import sys, math
MM_IN_INCH = 25.4
def size_and_ppi_from_resolution_and_diagonal(x, y, d): # pix, pix, mm
x, y, d = float(x), float(y), float(d)
@t184256
t184256 / keybase.md
Last active September 28, 2016 15:16

Keybase proof

I hereby claim:

  • I am t184256 on github.
  • I am t184256 (https://keybase.io/t184256) on keybase.
  • I have a public key ASDQi-vDQ2z-Rt6xOXMHcEv7rMUY5j-cq9FMEBhpY42dAwo

To claim this, I am signing this object:

@t184256
t184256 / frequency-info.txt
Last active October 19, 2017 03:19
Hungry X220
monk@cola$ cpupower frequency-info ~
analyzing CPU 0:
driver: intel_pstate
CPUs which run at the same hardware frequency: 0
CPUs which need to have their frequency coordinated by software: 0
maximum transition latency: Cannot determine or is not supported.
hardware limits: 800 MHz - 3.50 GHz
available cpufreq governors: performance powersave
current policy: frequency should be within 800 MHz and 3.50 GHz.
The governor "powersave" may decide which speed to use
@t184256
t184256 / pedal.py
Last active January 17, 2018 16:20
example of evdev/uinput based remapping, probably not the best one
import os
import atexit
import uinput
import evdev
#os.system('sudo modprobe uinput')
MAPPING = {
@t184256
t184256 / userdata_not_getable.rs
Created July 24, 2018 18:17
Userdata does not implement Getable
#[macro_use]
extern crate gluon_codegen;
extern crate gluon;
#[macro_use]
extern crate gluon_vm;
use std::sync::Arc;
use gluon::vm::{self, ExternModule};
use gluon::{import::Import, RootedThread};
@t184256
t184256 / layout.txt
Created January 17, 2018 16:27
My current keyboard layout for X220
HARDWARE = r'''
ESC F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12
` 1 2 3 4 5 6 7 8 9 0 - = YEN BS
TAB Q W E R T Y U I O P [ ]
C_LOCK A S D F G H J K L ; ' \ RET
LSHIFT Z X C V B N M , . / RO RSHIFT
LCTRL FN WIN ALT XX1 SPACE XX2 XX3 RA CP RCTRL BACK
'''
COLEMAK = r'''
@t184256
t184256 / what_a_monad_is_try1.md
Created September 23, 2018 20:02
What is a monad, attempt 1 of several

Skippable intro

tazjin once told me something koanish in the lines of:

When a man 'understands' monads, he writes a blog post about it. And it takes three such posts for him to really understand monads.

This text is my first 'post' in this hypothetised progression. I anticipate missing the point, so the intended audience is not other neophytes, but seasoned FP folk looking at me condenscendingly before replying "you're not there yet".

SERVER_KEY=server-key.pem
ADDRESS=555.555.555.555 # change this
# creating a key for our ca
if [ ! -e ca-key.pem ]; then
openssl genrsa -des3 -out ca-key.pem 1024
fi
# creating a ca
if [ ! -e ca-cert.pem ]; then
openssl req -new -x509 -days 1095 -key ca-key.pem -out ca-cert.pem -utf8 -subj "/CN=MyCA"