Skip to content

Instantly share code, notes, and snippets.

View ciehanski's full-sized avatar

Ryan Ciehanski ciehanski

View GitHub Profile
@minikomi
minikomi / filebuffer.go
Created June 9, 2012 10:27
Read file to buffered bytes buffer in chunks.
package main
import (
"bufio"
"bytes"
"fmt"
"io"
"log"
"os"
)
@artyom
artyom / resave.go
Created November 25, 2013 12:41
Remove EXIF data from image by resaving it.
package main
import (
"image"
"image/jpeg"
"log"
"os"
)
func main() {
@pascalpoitras
pascalpoitras / config.md
Last active June 23, 2024 15:33
My WeeChat configuration

WeeChat Screenshot

Mouse


enable


@brandonpittman
brandonpittman / ToggleSpellcheck.vim
Last active November 18, 2022 12:59
Toggle spellcheck on/off in vim
" Toggle spellchecking
function! ToggleSpellCheck()
set spell!
if &spell
echo "Spellcheck ON"
else
echo "Spellcheck OFF"
endif
endfunction
@mandiwise
mandiwise / Count lines in Git repo
Last active June 30, 2024 04:34
A command to calculate lines of code in all tracked files in a Git repo
// Reference: http://stackoverflow.com/questions/4822471/count-number-of-lines-in-a-git-repository
$ git ls-files | xargs wc -l
@mskutta
mskutta / EdgeRouter_IPv6_Commands_for_Comcast.txt
Last active December 6, 2023 02:11
EdgeRouter IPv6 Commands for Comcast
configure
# Configure Firewall
set firewall ipv6-name IPV6WAN_IN description 'IPV6WAN to internal'
set firewall ipv6-name IPV6WAN_IN default-action drop
set firewall ipv6-name IPV6WAN_IN rule 10 action accept
set firewall ipv6-name IPV6WAN_IN rule 10 state established enable
set firewall ipv6-name IPV6WAN_IN rule 10 state related enable
set firewall ipv6-name IPV6WAN_IN rule 10 log disable
@siburu
siburu / go-delete-slice-elements-in-loop.go
Created December 7, 2015 07:31
You must use a downward loop
// http://stackoverflow.com/questions/29005825/how-to-remove-element-of-struct-array-in-loop-in-golang
package main
func correctDeletion() {
var array [10]int
for i, _ := range array {
array[i] = i
}
s := array[:]
@jesselucas
jesselucas / changroup.go
Last active April 17, 2024 14:33
Simple solution for using a WaitGroup with select{}
package main
import (
"fmt"
"sync"
"time"
)
func main() {
// Create a wait group of any size
@joshbuchea
joshbuchea / semantic-commit-messages.md
Last active June 30, 2024 08:42
Semantic Commit Messages

Semantic Commit Messages

See how a minor change to your commit message style can make you a better programmer.

Format: <type>(<scope>): <subject>

<scope> is optional

Example

@kafene
kafene / gpg-wkd.md
Last active June 2, 2024 20:45
Setting up WKD for self-hosted automatic key discovery

I just got this working so I figured I'd share what I found, since there's hardly any information about this anywhere online except an RFC, the GPG mailing list and one tutorial from the GnuPG blog.

You can use automatic key discovery with WKD (Web key directory) to make it easy for users to import your key, in GPG since version 2.1.12. Since this feature is fairly new, it isn't yet available in the current LTS release of Ubuntu (16.04; xenial), however it is available in Debian stable (stretch).

I couldn't add a DNS CERT or DANE / OPENPGPKEY record through my email service (which also hosts my nameservers). I tried making the PKA record - a foo._pka.example.com TXT record but GPG doesn't seem to recognize it and fails; I'm still investigating why.

So the last option for self-hosted auto-discovery was WKD.

First thing I had to do was add an email address to my key. My primary UID is just my name so the key represents my identity rather