Skip to content

Instantly share code, notes, and snippets.

Avatar

Eric Duncan eduncan911

View GitHub Profile
@eduncan911
eduncan911 / go-build-all
Last active Jul 23, 2021
Go Cross-Compile Script
View go-build-all
#!/bin/bash
#
# GoLang cross-compile snippet for Go 1.6+ based loosely on Dave Chaney's cross-compile script:
# http://dave.cheney.net/2012/09/08/an-introduction-to-cross-compilation-with-go
#
# To use:
#
# $ cd ~/path-to/my-awesome-project
# $ go-build-all
#
@eduncan911
eduncan911 / Revert-Gist.md
Last active Jun 21, 2021
Revert Gist Commits
View Revert-Gist.md

Revert / Undo a Gist Commit

It was not exactly obvious. Here's how to revert a Gist commit!

Checkout the gist like a normal git repo:

# replace the Gist ID with your own
git clone git@github.com:cc13e0fcf2c348cc126f918e4a3917eb.git

Treat it like a normal repo. Edit, force push, etc.

@eduncan911
eduncan911 / main.go
Created Jun 9, 2016
Labels in GoLang
View main.go
package main
import "fmt"
/*
Here's a use of labels in Go to continue a for loop
from within another for and within a switch case.
*/
func main() {
@eduncan911
eduncan911 / README.md
Last active Mar 19, 2021
Fixing Thermal Throttling on Thinkpad P1 and X1 Extreme - Linux Edition
View README.md

Fixing Thermal Throttling on Thinkpad P1 and X1 Extreme - Linux Edition

Lenovo messed up with the X1E and P1 Gen 1 versions (and maybe later generations) in that the system boots with a thermal limit (aka Tjunction or tjmax) set to 82C (some report 80C). What this means is that regardless of power draw or under-volting settings, when your CPU hits 82C, it will drop the frequency down to the "Configurable TDP-down" frequency, or even lower. It will also may limits the system power draw.

Thermal Paste and Stress Testing

@eduncan911
eduncan911 / main.go
Created Jul 27, 2014
Go/Reading Console Inputs
View main.go
package main
import (
"bufio"
"fmt"
"os"
"strings"
)
func main() {
@eduncan911
eduncan911 / plex.sh
Created Apr 2, 2020
Plex + Docker + Updated Chromecast Ultra Config
View plex.sh
#!/usr/bin/env bash
#
# Plex's profile for Chromecast is too conservative and only plays 1080p on
# the Chromecast Ultra UHD device (4k).
#
# This script will download an updated Chromecast definition and start a Plex
# docker container, binding a few local paths of where you run this script.
#
# You may want to refer to the Official Plex Docker repository and read the
# README text: https://github.com/plexinc/pms-docker
View ddd-in-golang.markdown

This is my response to an email asking about Domain-Driven Design in golang project.

Thank you for getting in touch. Below you will find my thoughts on how golang works with DDD, changing it. This is merely a perception of how things worked out for us in a single project.

That project has a relatively well-known domain. My colleagues on this project are very knowledgeable, thoughtful and invested in quality design. The story spelled out below is a result of countless hours spent discussing and refining the approach.

Conclusions could be very different, if there was a different project, team or a story-teller.

Short story

@eduncan911
eduncan911 / gnome-install-extensions
Last active Jul 25, 2019
Gnome: Manually add several Extensions (or, for those that don't trust browser extensions)
View gnome-install-extensions
#!/bin/bash -e
# A script to mass install Gnome extensions from a single folder.
#
# for global extensions, use /usr/share/gnome-shell/extensions/
EXTENSIONS_DIR=~/.local/share/gnome-shell/extensions
TMP_DIR="/tmp/gnome-install-extensions"
DIR=$1
@eduncan911
eduncan911 / godoc2md-all
Last active Jun 20, 2018
Godoc2md for current and all sub-directories
View godoc2md-all
#!/bin/bash
# bash script to create a GoLang README.md in the current and all sub-directories.
#
# installation:
# place this in your ~/bin or similar. make sure to: chmod 755 godoc2md-all
#
# it is recommended to have a doc.go for each package, that allows for samples and
# additional instructions.
#
View keybase.md

Keybase proof

I hereby claim:

  • I am eduncan911 on github.
  • I am eduncan911 (https://keybase.io/eduncan911) on keybase.
  • I have a public key ASCm86SHMqJZdxyA3BUcpZKRZ8FKk7y93384uEKOOA1SZAo

To claim this, I am signing this object: