Skip to content

Instantly share code, notes, and snippets.

View VonC's full-sized avatar

VonC VonC

View GitHub Profile
@candlerb
candlerb / go-project-layout.md
Last active April 24, 2024 19:22
Suggestions for go project layout

If someone asked me the question "what layout should I use for my Go code repository?", I'd start by asking back "what are you building: an executable, or a library?"

Single executable

Stage 1: single source file

Create a directory named however you want your final executable to be called (e.g. "mycommand"), change into that directory, and create the following files:

@qapquiz
qapquiz / ask.sh
Created April 1, 2023 12:06
ask.sh (ask ChatGPT in command line)
#!/bin/bash
function ask_gpt() {
PROMPT=$(gum input --width 80 --placeholder "prompt")
if [[ -z "$PROMPT" ]]; then
exit 0
fi
gum style --foreground 212 "> $PROMPT"
@kellyrob99
kellyrob99 / repoAssetLister.groovy
Last active March 15, 2022 08:44
List all assets in a given repository that have been updated after a specific time
import org.sonatype.nexus.repository.storage.Asset
import org.sonatype.nexus.repository.storage.Query
import org.sonatype.nexus.repository.storage.StorageFacet
import groovy.json.JsonOutput
import groovy.json.JsonSlurper
def request = new JsonSlurper().parseText(args)
assert request.repoName: 'repoName parameter is required'
assert request.startDate: 'startDate parameter is required, format: yyyy-mm-dd'
@Komosa
Komosa / gheap.go
Last active November 7, 2015 11:38
Golang doesn't need neither runtime type-assertion nor code generation to provide generics
// this package is mostly copy-pasted from golang's std container/heap
// I changed Interface, Pop and Push in order to get rid of type assertions
// usage can be found in test file, benchmarks show that we can get about 27% of speedup for 1000 elems, or 10% for 10M elems (tested on go1.4)
package gheap
type Interface interface {
Len() int
Less(i, j int) bool
Swap(i, j int)
}
@sebastianha
sebastianha / .gitconfig
Last active January 11, 2017 14:44
Prevent GIT from commiting when user / email has not been adjusted for repo
# Everytime I clone a new GIT repo I always forget to set the user information to the specific values (privat, company, whatever)
# This entry in my .gitconfig prevents commiting as long I have not edited the local .git/config
#
# This workaround is based on the following stack-overflow question: http://stackoverflow.com/a/25050535
[user]
email = (none)\n\n\n====================================\n!!! E-MAIL NOT SET FOR THIS REPO !!!\n!!! Specify your name and e-mail !!!\n====================================\n\n\n
name = Firstname Lastname
@crosbymichael
crosbymichael / upgrade-lxc.sh
Created October 31, 2013 19:06
Docker on Ubuntu 13.10
#!/bin/bash
# Remove current lxc version which is lxc/1.0.0~alpha1-0ubuntu11
sudo apt-get remove lxc
# Download the new pakcages with the updated
wget https://launchpad.net/ubuntu/+source/lxc/1.0.0~alpha1-0ubuntu12/+build/5171688/+files/lxc_1.0.0~alpha1-0ubuntu12_amd64.deb
wget https://launchpad.net/ubuntu/+source/lxc/1.0.0~alpha1-0ubuntu12/+build/5171688/+files/liblxc0_1.0.0~alpha1-0ubuntu12_amd64.deb
# Install the updated packages
@stephsharp
stephsharp / README.md
Last active October 22, 2020 00:36
Stack Overflow user profile Dashing widget

Badge Overflow

An exceptionally handsome way to track your Stack Overflow badges.
Note: Badge Overflow now works with all Stack Exchange sites.

Created by Adam & Stephanie Sharp.

User Profile widget

A Dashing widget that

@richardcornish
richardcornish / git.md
Last active August 11, 2023 08:44
Enough Git for your résumé in 100ish lines
@HarryHuang
HarryHuang / cake_pattern_di.scala
Created November 19, 2011 11:54
Scala Dependency Injection: an improved cake pattern
//harry huang [huanghui.huang@gmail.com]
//
//After reading the original post [http://jboner.github.com/2008/10/06/real-world-scala-dependency-injection-di.html, ]
//the original cake pattern seems quite verbose for me, and it is quite invasive, so I spent a bit time
//and come up with an improved version of cake pattern, which I call it "Auto Cake DI". It is working
//well with any POST(plain old scala trait)/POSO(plain old scala object) which means that anything can be
//injected without modification or introducing new traits.
/*---------inject trait---------*/
trait Inject[+T] { def inject: T }
CC=gcc
CFLAGS=-Wall -std=c99 -ggdb
main: main.o hash.o
clean:
rm -f main main.o hash.o