Skip to content

Instantly share code, notes, and snippets.

View damdo's full-sized avatar

Damiano Donati damdo

View GitHub Profile
@zmb3
zmb3 / static_cgo.md
Created October 5, 2020 15:45
Compile static binaries for Go programs that leverage Cgo.

In order to compile a fully static binary when using Cgo you'll need to link in a C library like musl.

I find it convenient to have a Docker image ready for building these artifacts.

FROM golang
RUN wget https://www.musl-libc.org/releases/musl-1.2.0.tar.gz && \
   tar -zf musl-1.2.0.tar.gz && \
   cd musl-1.2.0 && \
 ./configure --enable-static --disable-shared && \
@weshouman
weshouman / 1-simple.mk
Last active February 20, 2024 18:16
Makefile function example
PATH = /tmp/
define myfn
processed_input=${PATH}/$(2)
$(1) := $$(processed_input)
endef
mytarget:
$(eval FILE=myfile)
$(eval $(call myfn,abs_filename,$(FILE)))
@mohanpedala
mohanpedala / bash_strict_mode.md
Last active June 1, 2024 08:46
set -e, -u, -o, -x pipefail explanation
@YumaInaura
YumaInaura / README.md
Last active November 21, 2023 05:48
Gist — Manage in one repository many gists by using git submodule

Gist — Manage in one repository many gists by using git submodule

Gist is a nice service. We can write code so easily and manage files as repository.

But bad points are …

  • Many repository
  • Gist destributes random hash to perticular gists (repositories).
  • So difficult to find or remember contents as repository.
@alexellis
alexellis / k8s-pi.md
Last active April 11, 2024 14:17
K8s on Raspbian

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment

@robertpainsi
robertpainsi / README.md
Last active March 21, 2024 10:45
How to reopen a pull-request after a force-push?

How to reopen a pull-request after a force-push?

Precodinitions

  • You need the rights to reopen pull requests on the repository.
  • The pull request hasn't been merged, just closed.

Instructions

  1. Write down the current commit hash of your PR-branch git log --oneline -1 <PR-BRANCH>
  2. Write down the latest commit hash on github before the PR has been closed.
  3. git push -f origin :
@briandk
briandk / vector-graphic-plots-preamble.py
Last active May 22, 2024 10:21
Preamble for high resolution and vector-graphic plots in Jupyter Notebook
# Make plots inline
%matplotlib inline
# Make inline plots vector graphics instead of raster graphics
# from IPython.display import set_matplotlib_formats
# set_matplotlib_formats('pdf', 'svg')
# DeprecationWarning: `set_matplotlib_formats` is deprecated since IPython 7.23, directly use `matplotlib_inline.backend_inline.set_matplotlib_formats()`
import matplotlib_inline
matplotlib_inline.backend_inline.set_matplotlib_formats('retina', 'png', quality = 100)