Skip to content

Instantly share code, notes, and snippets.

View t184256's full-sized avatar

Alexander Sosedkin t184256

View GitHub Profile
@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 / 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 / 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 / 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 / kbdremap.py
Created January 19, 2018 01:41
An admittedly messy keyboard layout remapper for a Japanese X220.
#!/usr/bin/python3
# Sorry everyone, it's a real mess.
import atexit
import inspect
import evdev
import evdev.ecodes as ec
@t184256
t184256 / example_remap.py
Created January 19, 2018 03:26
A thoroughly annotated example on keyboard remapping with evdev/uinput.
#!/usr/bin/python3
# CC0, originally written by t184256.
# This is an example Python program for Linux that remaps a keyboard.
# The events (key presses releases and repeats), are captured with evdev,
# and then injected back with uinput.
# This approach should work in X, Wayland, anywhere!
@t184256
t184256 / getable_woes.rs
Created July 24, 2018 17:37
Getable woes
#[macro_use]
extern crate gluon_codegen;
extern crate gluon;
#[macro_use]
extern crate gluon_vm;
use gluon::vm::{self, ExternModule};
use gluon::{import, Compiler, Thread};
use gluon::{import::Import, RootedThread};