Skip to content

Instantly share code, notes, and snippets.

@ony
ony / cherryPickOverlay.nix
Last active March 29, 2021 23:33
cherry-pick packages in nix between channels
# Motivation:
# - System uses <nixos> 20.09
# - Pulling any package from <nixpkgs-unstable> effectively keeps part of the system duplicated
self: super:
let
nixpkgs-unstable = import <nixpkgs-unstable> { };
cherryPick = pkg: pkg.override (origArgs: builtins.intersectAttrs origArgs self);
in {
zig-unstable = (cherryPick nixpkgs-unstable.zig).override {
@ony
ony / xorg-nvidia-outputs.md
Created August 25, 2020 22:58
Using nVidia as an overpriced output adapter for AMD

Original problem

  • Monitor with only DVI free port that supports native resolution.
  • Tired from nVidia tension with Linux and switching to AMD.
  • New AMD cards and built-in have no DVI output and adapter will arrive late.

Solution: use reverse prime with nouveau

It is well described in https://wiki.archlinux.org/index.php/PRIME#Reverse_PRIME But in this case I want to use AMD as a primary and nVidia as a "Source Output" which nouveau supports.

@ony
ony / notion_clean_activity.lua
Created July 19, 2020 21:34
Clean activity marker for all regions in notion WM
-- Help for those who many windows marked as if there is "activity" happening at once
function clean_all_activity()
local act_regions = {}
ioncore.activity_i(function(reg)
table.insert(act_regions, reg)
return true
end)
-- changes to activity list outside of iterator
for _,reg in ipairs(act_regions) do
@ony
ony / EXAMPLE.md
Last active November 12, 2019 21:53
Use of hledger-rewrite to re-factor journal

Journal

2019/10/1 (44555) FlixBus
	assets
	expenses:transport  $45
	; reimburse:employee

Mark ticket as claimed:

" minautopac.vim
" Naïve autoload of packs
" See https://github.com/k-takata/minpac/issues/28
" And https://github.com/junegunn/vim-plug/blob/9813d5e/plug.vim#L271-L276
function! minautopac#add(repo, ...)
let l:opts = get(a:000, 0, {})
if has_key(l:opts, 'for')
let l:name = substitute(a:repo, '^.*/', '', '')
let l:ft = l:opts.for " TODO: support array
@ony
ony / hledger-cli.hs
Created January 31, 2017 00:00
Prototype mix of implicit and explicit CmdArgs
#!/usr/bin/env stack
{- stack runghc --verbosity info
--package hledger
-}
{-# LANGUAGE DeriveDataTypeable #-}
import Data.Monoid
import Data.Maybe
import System.Console.CmdArgs.Implicit
import Hledger.Cli
@ony
ony / budgeting.md
Last active March 5, 2024 06:48
Budgeting with hledger

The main answers I need from budgeting:

  • How much extra money I can spend without compromising ability to pay my bills?
  • How big my earnings should be to cover my expenses?
  • How can I optimize my expenses?

Tracking your expenses

One of my favorite reports hledger supports is

@ony
ony / budget.bash
Last active December 22, 2018 08:18
Sample of building pipeline of hledger-rewrite
#!/bin/bash
budget_buckets() {
if [[ $# -eq 0 ]]; then
cat # no more re-writes
else
# parse next entry
local account="${1%% -> *}"
local budget="Budget:${1##* -> }"
shift
@ony
ony / PythonBaiscsCheatsheet.ipynb
Last active December 16, 2016 06:31
Just review of python basic
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ony
ony / gcc-5.3.0-issues.md
Last active January 8, 2016 17:37
Issues found with turning GCC 5.3.0 as a default compiler for Exherbo Linux

dev-lang/node-4.2.4:0::arbor

../deps/cares/src/ares_query.c: In function 'ares__generate_new_id':
../deps/cares/src/ares_query.c:104:16: internal compiler error: in create_tmp_var, at gimple-expr.c:519
 unsigned short ares__generate_new_id(rc4_key* key)

Builds normally without graphite options: -floop-interchange -ftree-loop-distribution -floop-strip-mine -floop-block