Skip to content

Instantly share code, notes, and snippets.

View rizo's full-sized avatar

Rizo I rizo

  • London, UK
View GitHub Profile
@rizo
rizo / plist-util.md
Last active February 22, 2023 10:04
Convert new plist files between XML and binary

Apple has introduced a new .plist file format in 10.4. You'll notice that you can no longer just edit a .plist file in TextEdit or other text editors. The reason for this is that the files are now binary rather than raw XML.

Luckily for us, there is a command line utility called plutil that can convert back and forth between the two formats. You can convert the .plist file you want to edit to XML format, edit it in TextEdit, then convert back to binary for use. To convert a binary .plist file to XML format for editing, type this in the Terminal:

plutil -convert xml1 some_file.plist

To convert an XML .plist file to binary for use:

plutil -convert binary1 some_other_file.plist
@rizo
rizo / Dockerfile
Last active January 19, 2023 20:14
Alpine (3.6) based docker image with Protocol Buffers compiler supporting Go.
# Protobuf Builder
# ================
#
# This image builds protocol buffers library from source with Go generation
# support. The builder and runner images are produced.
# Builder Image
# -------------
FROM golang:1.8.3-alpine3.6 as builder
@rizo
rizo / colors.py
Created June 20, 2013 20:26
Small python module for terminal colors usage.
__all__ = [
"color", "black", "dark_gray", "light_gray", "blue", "light_blue",
"green", "light_green", "cyan", "light_cyan", "red", "light_red",
"purple", "light_purple", "yellow", "brown", "white"
]
import os
# --------------------------------------------------------------------------- #
type ('a,'r) iter =
| Done of 'r
| Cont of ('a option -> ('a,'r) iter)
let head = let k x = Done x in Cont k
let len () =
let rec k acc x =
@rizo
rizo / README.md
Created March 30, 2020 12:32 — forked from hofmannsven/README.md
Increase key repeat rate on macOS

Increase key repeat rate on macOS

Settings: System Preferences » Keyboard » Key Repeat/Delay Until Repeat

Use the commands below to increase the key repeat rate on macOS beyond the possible settings via the user interface. The changes aren't applied until you restart your computer.

Source: https://apple.stackexchange.com/a/83923

type 'a printer = Format.formatter -> 'a -> unit
let inspect (pp : 'a printer) =
Format.(kfprintf (fun f -> pp_print_newline f ()) std_formatter "%a" pp)
let print ?(channel=stdout) fmt =
let f = Format.formatter_of_out_channel channel in
Format.(kfprintf (fun f -> pp_print_newline f ()) f fmt)
let int_to_bin_byte d =
if d < 0 then invalid_arg "bin_of_int" else
if d = 0 then "0" else
let rec aux acc d =
if d = 0 then acc else
aux (string_of_int (d land 1) :: acc) (d lsr 1)
in
let res = String.concat "" (aux [] d) in
if String.length res mod 8 <> 0 then
String.make (8 - String.length res mod 8) '0' ^ res
type property = string
(** Logic subsumption type: p |= q *)
type t = (property → property → bool)
(** Converts a property to a string representation. *)
let string_of_property p = p
@rizo
rizo / Dockerfile
Last active January 30, 2020 10:22
Dockerfile for esy projects.
# Build image
FROM node:10.13-alpine as build
# Prepare the environment to install esy.
RUN apk add --no-cache \
ca-certificates wget \
bash curl perl-utils \
git patch gcc g++ musl-dev make m4
module Continuation : sig
type ('a, 'r) t = ('a -> 'r) -> 'r
val return : 'a -> ('a, 'r) t
val (>>=) : ('a, 'r) t -> ('a -> ('b, 'r) t) -> ('b, 'r) t
end = struct
type ('a, 'r) t = ('a -> 'r) -> 'r
let return x = fun k -> k x