Skip to content

Instantly share code, notes, and snippets.

View fearofcode's full-sized avatar
🎵
Take that chance / All day long / Fucking up so fucking strong

Warren Henning fearofcode

🎵
Take that chance / All day long / Fucking up so fucking strong
View GitHub Profile
@fearofcode
fearofcode / export.py
Last active September 17, 2024 00:52
Simple anki export of a Plover steno dictionary using the genanki (https://github.com/kerrickstaley/genanki) library
# Copyright (C) 2024 Warren Henning
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@fearofcode
fearofcode / pollkeys.cpp
Created May 17, 2024 01:24 — forked from lierdakil/pollkeys.cpp
Linux polling all key event devices for key presses (minimalist example)
// Note: uses C++17 fs features; build with
// g++ -std=c++17 event-reader.cpp -lstdc++fs
//
// Licensed under the following terms:
// DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
// Version 2, December 2004
//
// Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
//
// Everyone is permitted to copy and distribute verbatim or modified
@fearofcode
fearofcode / stacked_widget_example.py
Last active October 19, 2023 04:21
example of changing currently displayed widgets/layout in PyQt6 using QStackedWidget
import sys
from PyQt6.QtWidgets import (
QApplication,
QCheckBox,
QLabel,
QLineEdit,
QRadioButton, )
from PyQt6.QtWidgets import QHBoxLayout, QFormLayout, QStackedWidget, QListWidget, QWidget
@fearofcode
fearofcode / lispy.py
Created August 12, 2022 22:01
https://norvig.com/lispy2.html with its test suite updated to work on Python 3
"""
Scheme Interpreter in Python
(c) Peter Norvig, 2010; See http://norvig.com/lispy2.html
Fixes to run on Python 3 and minor style tweaks from Warren Henning, 2022 <warren.henning@gmail.com>
"""
import cmath
import math
@fearofcode
fearofcode / Default (Windows).default-keymap
Last active July 9, 2022 22:57
basic Sublime Text 4 Clojure setup: Clojure-Sublimed + LSP
[
// Evaluate
{"keys": ["ctrl+enter"],
"command": "clojure_sublimed_eval",
"context": [{"key": "selector", "operator": "equal", "operand": "source.clojure"}]},
// Evaluate Buffer
{"keys": ["ctrl+b"],
"command": "clojure_sublimed_eval_buffer",
"context": [{"key": "selector", "operator": "equal", "operand": "source.clojure"}]},
@fearofcode
fearofcode / .emacs
Last active July 5, 2022 02:28
minimal .emacs for windows with sbcl and Slime
;; http://www.sbcl.org/platform-table.html
;; add C:\Program Files\Steel Bank Common Lisp\ to path
;; https://github.com/slime/slime#quick-setup-instructions
;; if you get a file not found error while installing, run M-x package-refresh-contents
;; this file goes in C:\<user>\AppData\Roaming\.emacs or just ~/.emacs in the app itself
(require 'package)
(add-to-list 'package-archives '("melpa" . "https://melpa.org/packages/") t)
;; Comment/uncomment this line to enable MELPA Stable if desired. See `package-archive-priorities`
;; and `package-pinned-packages`. Most users will not need or want to do this.
Failed to build network-2.8.0.1. The failure occurred during the configure
step.
Build log (
C:\Users\warre\AppData\Roaming\cabal\logs\ghc-8.8.1\network-2.8.0.1-c11bae4bd2c01b0552b41fcaaf67516daa169c36.log
):
Configuring network-2.8.0.1...
cabal.exe: The package has a './configure' script. If you are on Windows, This
requires a Unix compatibility toolchain such as MinGW+MSYS or Cygwin. If you
are not on Windows, ensure that an 'sh' command is discoverable in your path.
@fearofcode
fearofcode / learning_gtk.c
Created November 10, 2019 07:18
very first gtk program that checks that the library is installed
#include <gtk/gtk.h>
/* to compile in ubuntu:
*
* sudo apt install libgtk2.0-dev
*
* in bash: gcc `pkg-config --cflags --libs gtk+-2.0` learning_gtk.c -o learning_gtk
* in fish shell: gcc learning_gtk.c (pkg_config --cflags --libs gtk+-2.0 | perl -pe
* 's/\s+/\n/g) -o learning_gtk
*/
@fearofcode
fearofcode / dynamic_compilation.cs
Last active November 4, 2019 08:10
Simple example of dynamically compiled code that can access data in the program that compiles the assembly
using System;
using System.Diagnostics;
using System.Linq;
namespace csharpdynamiccompilationtest
{
public class RegularClass
{
public static int Get(int[] i) { return i.Sum() + Program.rng.Next(1, 5); }
}
@fearofcode
fearofcode / win32_handmade.cpp
Created October 27, 2019 07:32
Handmade Hero Day 1 with DPI awareness
#include <windows.h>
#include <shellscalingapi.h>
int CALLBACK
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow)
{
// https://docs.microsoft.com/en-us/windows/win32/api/shellscalingapi/nf-shellscalingapi-setprocessdpiawareness
SetProcessDpiAwareness(PROCESS_PER_MONITOR_DPI_AWARE);
MessageBoxA(0, "Message box text!", "Message Box information", MB_OK|MB_ICONINFORMATION);