Skip to content

Instantly share code, notes, and snippets.

View ivan's full-sized avatar
🕸️

Ivan Kozik ivan

🕸️
View GitHub Profile
@ivan
ivan / userscript-github.js
Last active August 31, 2016 22:08
Fix styles on github.com and gist.github.com
// ==UserScript==
// @name GitHub: Fix styles
// @namespace github_styles
// @include *://github.com/*
// @include *://gist.github.com/*
// @version 1
// @grant GM_addStyle
// ==/UserScript==
// Note: colors are calibrated for a TN panel at low brightness, redshift -O 4500
@ivan
ivan / mkdeb.fish
Last active September 6, 2016 14:04
Scripting in fish
#!/usr/bin/fish
set here (pwd)
and set out $here/ubuntils.deb
and set git_temp (mktemp -d)
and cd $git_temp; and git clone -q -b bien ~/code/system/ubuntils
and set deb_temp (mktemp -d)
and cd $deb_temp
wget 'https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F407803%2Fchrome-linux.zip?alt=media' -O 407803.zip
wget 'https://www.googleapis.com/download/storage/v1/b/chromium-browser-snapshots/o/Linux_x64%2F407808%2Fchrome-linux.zip?alt=media' -O 407808.zip
@ivan
ivan / depmapper.exs
Last active September 26, 2016 17:08
Hacking mix to globally map Hex dependencies to audited git repositories
# ~/.mix/depmapper.exs
defmodule Mix.DepMapper do
@repos_path "/ejail/code/erlang"
# The branch to check out. My workflow is to mark audited known-good
# commits with both a branch and timestamped tag using
# https://github.com/ludios/tagmyrebase
@default_branch "bien"
def mapdep(dep) do
@ivan
ivan / fonts.conf.xml
Created September 29, 2016 06:06
~/.config/fontconfig/fonts.conf
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<fontconfig>
<!-- Don't use embedded bitmap in Cambria and other fonts: https://bugzilla.mozilla.org/show_bug.cgi?id=722356#c6 -->
<match target="font">
<edit name="embeddedbitmap" mode="assign">
<bool>false</bool>
</edit>
</match>
<alias>
@ivan
ivan / quoting.ex
Created September 30, 2016 16:24
quoting.ex
iex(9)> quote do {1} end
{:{}, [], [1]}
iex(10)> quote do {1, 2} end
{1, 2}
iex(11)> quote do {1, 2, 3} end
{:{}, [], [1, 2, 3]}
@ivan
ivan / append_if.ex
Last active October 22, 2016 18:27
defmodule LangUtil do
@doc ~S"""
For use in a pipeline like so:
s
|> append_if(c.section, "Section: #{c.section}\n")
|> append_if(true, "Description: #{c.short_description}\n")
|> append_if(c.long_description, prefix_every_line(c.long_description, " ") <> "\n")
`expression` is not evaluated unless evaluation of `clause` is truthy. This avoids
defmodule LangUtil do
@doc ~S"""
For use in a pipeline like so:
{s, &Kernel.<>/2}
|> oper_if(c.section, "Section: #{c.section}\n")
|> oper_if(true, "Description: #{c.short_description}\n")
|> oper_if(c.long_description, prefix_every_line(c.long_description, " ") <> "\n")
|> elem(0)
@ivan
ivan / zshrc
Last active April 23, 2023 17:03
#!/bin/zsh
# This is meant to be sourced; shebang line is for editors
umask 027
# Let me type a ! in a filename without escaping it
set +o histexpand
# http://www.zsh.org/mla/workers/1996/msg00615.html
HISTSIZE=21000
@ivan
ivan / gist:3c846dbcef0f3897c1935449d1af6111
Created October 26, 2016 23:40
List of OEM commands you can run on a Moto G LTE XT1045
# ./platform-tools/fastboot oem help
(bootloader) slot-count: not found
(bootloader) slot-suffixes: not found
(bootloader) slot-suffixes: not found
...
(bootloader) config...
(bootloader) partition...
(bootloader) ramdump...
(bootloader) blankflash
(bootloader) fb_mode_set