Skip to content

Instantly share code, notes, and snippets.

View dlsniper's full-sized avatar

Florin Pățan dlsniper

View GitHub Profile
@dlsniper
dlsniper / custom.go
Last active June 6, 2023 08:03
Custom logger based on slog
// The code in this file is partially taken from the
// golang.org/x/exp/[email protected]
//
// Copyright 2022 The Go Authors. All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
package logger
import (
@dlsniper
dlsniper / make.log
Created May 5, 2022 17:44
/var/lib/dkms/nvidia/470.86/build/make.log
/var/lib/dkms/nvidia/470.86/build/make.log
DKMS make.log for nvidia-470.86 for kernel 5.17.5-76051705-generic (x86_64)
Thu May 5 20:05:59 EEST 2022
make[1]: Entering directory '/usr/src/linux-headers-5.17.5-76051705-generic'
test -e include/generated/autoconf.h -a -e include/config/auto.conf || ( \
echo >&2; \
echo >&2 " ERROR: Kernel configuration is invalid."; \
echo >&2 " include/generated/autoconf.h or include/config/auto.conf are missing.";\
echo >&2 " Run 'make oldconfig && make prepare' on kernel src to fix it."; \
@dlsniper
dlsniper / fetchFileWatcher.sh
Created February 12, 2020 07:04
Get the contents of the Linux File Watcher component for JetBrains IDEs
#!/usr/bin/env bash
mkdir ~/jbFileWatcher
cd ~/jbFileWatcher
wget https://raw.githubusercontent.com/JetBrains/intellij-community/master/native/fsNotifier/linux/fsnotifier.h
wget https://raw.githubusercontent.com/JetBrains/intellij-community/master/native/fsNotifier/linux/inotify.c
wget https://raw.githubusercontent.com/JetBrains/intellij-community/master/native/fsNotifier/linux/main.c
wget https://raw.githubusercontent.com/JetBrains/intellij-community/master/native/fsNotifier/linux/make.sh
wget https://raw.githubusercontent.com/JetBrains/intellij-community/master/native/fsNotifier/linux/util.c
@dlsniper
dlsniper / go.mod
Created November 4, 2019 06:37
Sample Web App
module github.com/dlsniper/dockerdev
go 1.11
require github.com/jackc/pgx/v4 v4.1.2
@dlsniper
dlsniper / custom.sh
Created July 16, 2018 11:28
Shell Script to perform tasks on binary
#!/bin/env bash
# Compile the using one of these commands:
# for Go 1.10 or later
go build -gcflags "all=-N -l" -o /tmp/demo github.com/app/demo
# for Go 1.9 or earlier
# go build -gcflags "-N -l" -o /tmp/demo github.com/app/demo
Command failed: Internal debugger error: <nil> not a Bool
runtime.call32 (0x454a11)
C:/Go1.11/src/runtime/asm_amd64.s:522
runtime.gopanic (0x42c396)
C:/Go1.11/src/runtime/panic.go:494
go/constant.BoolVal (0x5e432a)
C:/Go1.11/src/go/constant/value.go:438
github.com/derekparker/delve/pkg/proc.evalBreakpointCondition (0x68649c)
D:/go/src/github.com/derekparker/delve/pkg/proc/breakpoints.go:190
github.com/derekparker/delve/pkg/proc.(*Breakpoint).CheckCondition (0x68605e)
@dlsniper
dlsniper / buffalo-error.txt
Created June 16, 2018 11:15
Buffalo 0.12 error
florin@Monzi10 [02:11:01 PM] [~/go/src/github.com/dlsniper]
-> % buffalo new buffy
--> /home/florin/go/src/github.com/dlsniper/buffy/.buffalo.dev.yml
--> /home/florin/go/src/github.com/dlsniper/buffy/assets/images/logo.svg
--> /home/florin/go/src/github.com/dlsniper/buffy/.babelrc
--> /home/florin/go/src/github.com/dlsniper/buffy/package.json
--> /home/florin/go/src/github.com/dlsniper/buffy/public/assets/.keep
--> /home/florin/go/src/github.com/dlsniper/buffy/webpack.config.js
--> /home/florin/go/src/github.com/dlsniper/buffy/assets/css/application.scss
--> /home/florin/go/src/github.com/dlsniper/buffy/assets/images/favicon.ico
@dlsniper
dlsniper / cmd.sh
Last active November 18, 2019 17:47
small repo track all packages
#!/usr/bin/env bash
go get -u smallrepo.com/sml
GOPATH=/path/to/gopath sml track cloud.google.com/go collectd.org dmitri.shuralyov.com/app/changes dmitri.shuralyov.com/html/belt dmitri.shuralyov.com/route/github dmitri.shuralyov.com/scratch dmitri.shuralyov.com/service/change dmitri.shuralyov.com/state dmitri.shuralyov.com/website/gido git.apache.org/thrift.git github.com/AaronO/go-git-http github.com/AlekSi/pointer github.com/AndreasBriese/bbloom github.com/BurntSushi/toml github.com/DataDog/datadog-go github.com/Knetic/govaluate github.com/NYTimes/gziphandler github.com/PuerkitoBio/gocrawl github.com/PuerkitoBio/goquery github.com/PuerkitoBio/purell github.com/PuerkitoBio/urlesc github.com/RoaringBitmap/roaring github.com/Shopify/sarama github.com/TrueFurby/go-callvis github.com/Unknwon/cae github.com/VividCortex/gohistogram github.com/Yawning/chacha20 github.com/adtac/go-akismet github.com/afex/hystrix-go github.com/alcortesm/tgz github.com/alecthomas/chroma github.com/alecthomas/gometalinter github.com/
@dlsniper
dlsniper / Gopkg.lock
Last active March 26, 2018 12:35
dependency versions
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.
[[projects]]
name = "github.com/aws/aws-sdk-go"
packages = [
"aws",
"aws/awserr",
"aws/awsutil",
"aws/client",

This proposal would lead to interfaces forcing structs as types to implement them, whereas today it's possible to have the implementation be a completely different type, like a func or a string, for example, see https://play.golang.org/p/irTsnlldaea as an example for this.

package main

import "fmt"

type (
	demo    func()
	hello   string