$mod
refers to the modifier key (alt by default)
startx i3
start i3 from command line$mod+<Enter>
open a terminal$mod+d
open dmenu (text based program launcher)$mod+r
resize mode ( or to leave resize mode)$mod+shift+e
exit i3
// How to design a Go slice type that needs to be sortable in many ways. | |
package main | |
import ( | |
"fmt" | |
"sort" | |
) | |
type data struct { | |
i int |
#!/bin/bash | |
# | |
# Check a "few" things to help write more maintainable Go code. | |
# | |
# OK, it's fairly comprehensive. So simply remove or comment out | |
# anything you don't want. | |
# | |
# Don't forget to install (go get) each of these tools. | |
# More info at the URLs provided. | |
# |
# see https://www.topbug.net/blog/2013/04/14/install-and-use-gnu-command-line-tools-in-mac-os-x/ | |
# core | |
brew install coreutils | |
# key commands | |
brew install binutils | |
brew install diffutils | |
brew install ed --default-names | |
brew install findutils --with-default-names |
package main | |
/** | |
* @website http://albulescu.ro | |
* @author Cosmin Albulescu <cosmin@albulescu.ro> | |
*/ | |
import ( | |
"bytes" | |
"fmt" |
### | |
### | |
### UPDATE: For Win 11, I recommend using this tool in place of this script: | |
### https://christitus.com/windows-tool/ | |
### https://github.com/ChrisTitusTech/winutil | |
### https://www.youtube.com/watch?v=6UQZ5oQg8XA | |
### iwr -useb https://christitus.com/win | iex | |
### | |
### |
/* | |
* Copyright (c) 2014, Yawning Angel <yawning at torproject dot org> | |
* All rights reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions are met: | |
* | |
* * Redistributions of source code must retain the above copyright notice, | |
* this list of conditions and the following disclaimer. | |
* |
package main | |
import ( | |
"bufio" | |
"flag" | |
"fmt" | |
"io" | |
"os" | |
"strings" | |
) |
There are three easy to make mistakes in go. I present them here in the way they are often found in the wild, not in the way that is easiest to understand.
All three of these mistakes have been made in Kubernetes code, getting past code review at least once each that I know of.
What do these lines do? Make predictions and then scroll down.
func print(pi *int) { fmt.Println(*pi) }
/* | |
fmt.Println(Bitmask(0x6).IsSet(0x2)) | |
fmt.Println(Bitmask(f.FileHeader.Characteristics).ListDescriptions(charValues)) | |
fmt.Println(Bitmask(f.FileHeader.Characteristics).ListValues(charValues)) | |
*/ | |
type Bitmask uint16 | |
// BitValue is a value and a description | |
type BitValue struct { |