Skip to content

Instantly share code, notes, and snippets.

@guyzmo
guyzmo / mouse_buttons_as_keys.py
Created January 31, 2017 17:36
Mouse key remap for Thinkpad trackpoint
#!/usr/bin/python3.5
# -*- coding: utf-8 -*-
"""
Sort of mini driver.
Read a specific InputDevice (my_mx_mouse),
monitoring for special thumb button
Use uinput (virtual driver) to create a mini keyboard
"""
@guyzmo
guyzmo / regex_warnings
Created February 9, 2017 13:45
neomutt: regex.c warnings
../regex.c: In function ‘re_compile_fastmap’:
../regex.c:1183:26: warning: assignment from incompatible pointer type [-Wincompatible-poi
nter-types]
: ((fail_stack).stack = \
^
../regex.c:1199:9: note: in expansion of macro ‘DOUBLE_FAIL_STACK’
&& !DOUBLE_FAIL_STACK (FAIL_STACK)) \
^~~~~~~~~~~~~~~~~
../regex.c:3341:20: note: in expansion of macro ‘PUSH_PATTERN_OP’
if (!PUSH_PATTERN_OP (p + j, fail_stack))
@guyzmo
guyzmo / identity_sort_of_menu
Created February 10, 2017 15:38
multiple identities sort-of-menu
alias identity_1 Me <me@one>
alias identity_2 Myself <myself@two>
alias identity_3 I <I@three>
macro compose v "<edit-from>^Uidentity_<tab>" "Select from"
@guyzmo
guyzmo / manual.head.xml
Last active February 11, 2017 16:38
xml crap
<?xml version="1.0" standalone="no"?>
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
<book>
<bookinfo>
<title>The Mutt E-Mail Client</title>
<author>
<firstname>Michael</firstname><surname>Elkins</surname>
<email>me@cs.hmc.edu</email>
@guyzmo
guyzmo / git.weboob.org-ipv4-curl.log
Created February 18, 2017 19:41
IPv6 Connection issue to git.weboob.org
* Rebuilt URL to: https://git.weboob.org/
* Trying 136.243.171.154...
* TCP_NODELAY set
* Connected to git.weboob.org (136.243.171.154) port 443 (#0)
* ALPN, offering http/1.1
* Cipher selection: ALL:!EXPORT:!EXPORT40:!EXPORT56:!aNULL:!LOW:!RC4:@STRENGTH
* successfully set certificate verify locations:
* CAfile: /etc/ssl/certs/ca-certificates.crt
CApath: none
* TLSv1.2 (OUT), TLS header, Certificate Status (22):
@guyzmo
guyzmo / busted.log
Last active February 19, 2017 02:38
first unit test case for neomutt
+++++
5 successes / 0 failures / 0 errors / 0 pending : 0.099498 seconds
@guyzmo
guyzmo / busted_functional.log
Created February 19, 2017 02:15
first functional test case for neomutt
+++++++++++++
13 successes / 0 failures / 0 errors / 0 pending : 0.020419 seconds
@guyzmo
guyzmo / build.log
Created March 6, 2017 09:43
gprbuild build log
-> Found Makefile.archy
-> Found patch-configure.in
==> Validating source files with sha1sums...
57399662c7a447658e0affa8 ... Passed
Makefile.archy ... Passed
patch-configure.in ... Passed
==> Extracting sources...
-> Extracting 57399662c7a447658e0affa8 with bsdtar
==> Starting prepare()...
patching file configure.in
@guyzmo
guyzmo / int_list_pkg.adb
Created March 9, 2017 11:15
int_list_pkg
package Int_List_Pkg is
type Int_List (Max_Length : Natural) is private
with Type_Invariant => Is_Sorted (Int_List);
function Is_Sorted (List : Int_List) return Boolean;
type Int_array is array (Positive range <>) of Integer;
function To_Int_List (Ints : Int_Array) return Int_List;
@guyzmo
guyzmo / exercise_advanced_checkpoint.adb
Created March 10, 2017 12:52
exercise advanced checkpoint
-- Consider a workshop where several workers (tasks) assembly details of some mechanism. When each of them completes his work they put the details together. There is no store, so a worker who finished its part first must wait for others before starting another one. Putting details together is the checkpoint at which tasks synchronize themselves before going their paths apart.
--
-- The task
-- Implement checkpoint synchronization in your language.
-- Make sure that the solution is race condition-free.
-- Note that a straightforward solution based on events is exposed
-- to race condition. Let two tasks A and B need to be synchronized
-- at a checkpoint. Each signals its event (EA and EB correspondingly),
-- then waits for the AND-combination of the events (EA&EB) and resets
-- its event. Consider the following scenario: A signals EA first and