Skip to content

Instantly share code, notes, and snippets.

View drognisep's full-sized avatar

Doug Saylor drognisep

View GitHub Profile
@drognisep
drognisep / testutil.go
Last active January 8, 2022 21:18
Timed Test
package testutil
import (
"context"
"testing"
"time"
)
// AssertTimeLimit asserts a time limit on a verification.
func AssertTimeLimit(t *testing.T, test func(t *testing.T), duration time.Duration) {
@drognisep
drognisep / .gitaliases
Last active May 21, 2023 21:59
Git aliases
alias g="git status"
alias gch="git checkout"
alias gchb="git checkout -b"
alias glog="git log"
alias glogg="git log --graph"
alias glogga="git log --graph --all --decorate"
alias ga="git add ."
alias gai="git add -i"
alias gc="git commit"
alias gcm="git commit -m"
@drognisep
drognisep / main.go
Last active November 15, 2020 18:57
Testing custom dialog validation
package main
import (
"errors"
"fmt"
"fyne.io/fyne"
"fyne.io/fyne/app"
"fyne.io/fyne/container"
"fyne.io/fyne/dialog"
"fyne.io/fyne/layout"
@drognisep
drognisep / main.go
Created August 23, 2020 17:34
Testing window hang behavior
package main
import (
"fmt"
"os"
"fyne.io/fyne"
"fyne.io/fyne/app"
"fyne.io/fyne/layout"
"fyne.io/fyne/widget"
@drognisep
drognisep / PyiUtils.py
Last active May 18, 2020 03:34
Runtime util for working with PyInstaller paths
# MIT License
#
# Copyright (c) 2020 Doug Saylor
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# Clean up feature branch remotes
gbra | grep remotes/origin/feature | sed -e 's/remotes\///g' | xargs -L 1 -I '{}' git branch -dr {}
#!/bin/bash
find . -name "__pycache__" -exec rm -r {} +
@drognisep
drognisep / clean-up-boot-partition-ubuntu.md
Created May 8, 2019 21:14 — forked from ipbastola/clean-up-boot-partition-ubuntu.md
Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Safest way to clean up boot partition - Ubuntu 14.04LTS-x64, Ubuntu 16.04LTS-x64

Reference

Case I: if /boot is not 100% full and apt is working

1. Check the current kernel version

$ uname -r 
@drognisep
drognisep / showGradleTestResults.md
Last active May 21, 2019 15:44
Show Gradle test results

Show test results in a single build.gradle.

tasks.withType(Test) {
    afterTest {
        desc, result ->
            def lastIdx = desc.className.lastIndexOf(('.' as char) as int)
            def className = desc.className.substring(lastIdx + 1)
            logger.quiet "\t[TEST] [$className] $desc.name: $result.resultType"
    }
}
@drognisep
drognisep / enforce-range.py
Created January 21, 2019 16:17
Algorithm to enforce a positive range on an integer
# I can never seem to remember this algorithm when I need it so I figured I'd just jot it down here for posterity.
import random
# min and max are assumed to be positive integers, and min is assumed to be less than max.
max = 4
min = 1
# This part is to set the upper bound (inclusive with the + 1), but dropping it by the minimum so we know it's safe to add it back in.
num = abs(random.randint(0, 8192)) % (max - min + 1)