Skip to content

Instantly share code, notes, and snippets.

@vangberg
vangberg / DWM-ON-OS-X.md
Created February 22, 2010 19:24
dwm on os x [work in progress!]

Installing and configuring dwm on OS X

  1. Install XQuartz (http://xquartz.macosforge.org) which is the development version of the X11.app that ships with OS X, which means it is way more up to date. I have had some weird issues with X11.app v. 2.3-something. XQuartz 2.5.0 fixed that.

  2. Install dwm from Homebrew, brew install dwm. This makes a bunch of necessary tweaks to the DWM configuration.

  3. Add the following script to $PATH, name it dwm-launch and chmod 755:

    cd ~
    

while true

@pfig
pfig / mkfavicon.sh
Created February 12, 2012 12:01
Make a multi-resolution favicon.ico from a source image, using ImageMagick
#!/bin/bash
# from
# http://bergamini.org/computers/creating-favicon.ico-icon-files-with-imagemagick-convert.html
convert source-WxW.png -resize 256x256 -transparent white favicon-256.png
convert favicon-256.png -resize 16x16 favicon-16.png
convert favicon-256.png -resize 32x32 favicon-32.png
convert favicon-256.png -resize 64x64 favicon-64.png
convert favicon-256.png -resize 128x128 favicon-128.png
@dejanr
dejanr / README
Last active June 11, 2023 20:35
OSX, X11, dwm, urxvt, vim environment
OSX Apps
- Total Spaces, for keeping X11 in different space and faster switching
- MenuAndDockless for hidding topbar menu
X11 - Macports
- sudo port install xorg-server
- sudo port install xinit
- sudo port install terminus-font dejavu-fonts bitstream-fonts
Suckless - suckless.org
@filewalkwithme
filewalkwithme / main.go
Last active February 16, 2024 23:22
Listening multiple ports on golang http servers (using http.Handler)
package main
import (
"net/http"
)
func main() {
go func() {
http.ListenAndServe(":8001", &fooHandler{})
}()
@jbeda
jbeda / nar-spec.md
Created September 1, 2015 23:04
Nix Archive (NAR) file specification

This is taken directly from Figure 5.2 in http://nixos.org/~eelco/pubs/phd-thesis.pdf. It is presented here to be more directly linkable.

serialise(fso) = str("nix-archive-1") + serialise1(fso)

serialise1(fso) = str("(") + seralise2(fso) + str(")")

serialise2(type=Regular, exec, contents) =
  str("type") + str("regular")
 + (
@Bananattack
Bananattack / readme_zoom2x.md
Last active May 21, 2016 21:13
A two-pass paletted pixel-scaling algorithm that uses weighting counting of adjacent colors and a fitness function (for tie-breaking) to create a 2x scale image. This is not an efficient implementation, just a quick-and-dirty proof of concept.

The "zoom2x" algorithm

by Andrew G. Crowell

A two-pass paletted pixel-scaling algorithm that uses weighting counting of adjacent colors and a fitness function (for tie-breaking) to create a 2x scale image.

This is not an efficient implementation, just a quick-and-dirty proof of concept. So it is mainly useful for offline rendering right now, but a few optimizations to create less temporary memory and it could be made pretty quick. In particular, the best_sample function will create a dictionary every call, resulting in a lot of garbage. This algorithm could directly work on an indexed image instead and then the weight array be a fixed-length array that is the size of the image color palette (possibly 16 or 256-color or whatever) that's shared between calls and just cleared before use, and then this should result in way fewer allocations. Also somebody could write it in a systems language like C++ or Rust instead of Python -- which would also help a lot, and hopefully wouldn't be too bad to port.

Tu

Thread 1 "foo" hit Breakpoint 1, fmt.Printf (format="%v\n", a= []interface {} = {...}, n=859530404224, err=...) at /usr/lib/golang/src/fmt/print.go:196
196 func Printf(format string, a ...interface{}) (n int, err error) {
(gdb) disas
Dump of assembler code for function fmt.Printf:
=> 0x000000000045a700 <+0>: mov %fs:0xfffffffffffffff8,%rcx
0x000000000045a709 <+9>: cmp 0x10(%rcx),%rsp
0x000000000045a70d <+13>: jbe 0x45a7f2 <fmt.Printf+242>
0x000000000045a713 <+19>: sub $0x60,%rsp
0x000000000045a717 <+23>: xor %ebx,%ebx
0x000000000045a719 <+25>: xor %ebx,%ebx
@jmhobbs
jmhobbs / README.md
Last active March 24, 2023 15:19
Create scrolling text gifs for Slack

Makes little scrolly text jiffs in Flywheel colors.

Prerequisites

  • imagemagick brew install imagemagick
  • gifsicle brew install gifsicle
  • Heartwell 1.2.otf font installed
  • u r on a mac

Usage

@jessfraz
jessfraz / boxstarter.ps1
Last active April 11, 2024 16:02
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <jess@linux.com>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
@posener
posener / go-table-driven-tests-parallel.md
Last active April 30, 2024 20:34
Be Careful with Table Driven Tests and t.Parallel()

Be Careful with Table Driven Tests and t.Parallel()

We Gophers, love table-driven-tests, it makes our unittesting structured, and makes it easy to add different test cases with ease.

Let’s create our table driven test, for convenience, I chose to use t.Log as the test function. Notice that we don't have any assertion in this test, it is not needed to for the demonstration.

func TestTLog(t *testing.T) {
	t.Parallel()