Skip to content

Instantly share code, notes, and snippets.

View niqdev's full-sized avatar

niqdev

  • Dublin
View GitHub Profile
@niqdev
niqdev / docker_cleanup.sh
Last active December 5, 2023 22:12
docker cleanup
# deletes all containers including its volumes use
docker rm -vf $(docker ps -aq)
# delete dangling images <none>
docker images -q -f dangling=true | xargs --no-run-if-empty docker rmi -f
# deletes all the images (remove all the containers first)
docker rmi -f $(docker images -aq)
# removes all unused containers, volumes, networks and images
@niqdev
niqdev / dropdown.md
Created May 29, 2023 13:48 — forked from citrusui/dropdown.md
"Dropdowns" in Markdown
How do I dropdown?
This is how you dropdown.

<details>
<summary>How do I dropdown?</summary>
<br>
This is how you dropdown.
@niqdev
niqdev / rust-command-line-utilities.markdown
Created April 28, 2023 16:59 — forked from sts10/rust-command-line-utilities.markdown
A curated list of command-line utilities written in Rust

A curated list of command-line utilities written in Rust

Note: I have moved this list to a proper repository. I'll leave this gist up, but it won't be updated. To submit an idea, open a PR on the repo.

Note that I have not tried all of these personally, and cannot and do not vouch for all of the tools listed here. In most cases, the descriptions here are copied directly from their code repos. Some may have been abandoned. Investigate before installing/using.

The ones I use regularly include: bat, dust, fd, fend, hyperfine, miniserve, ripgrep, just, cargo-audit and cargo-wipe.

  • atuin: "Magical shell history"
  • bandwhich: Terminal bandwidth utilization tool
@niqdev
niqdev / README.md
Created March 15, 2023 22:08 — forked from Potherca/README.md
Converting a webm file to GIF (using FFmpeg and Gifsicle)

Introduction

Sometimes I want to make a screencapture of a websites behaviour.

In Chrome, I am quite happy doing this with the [Awesome Screenshot: Screen Video Recorder][1] extension.

Besides screenshots, the extension offers the ability to make a recording. (Limited to 30 seconds in the free version).

The recording can be uploaded to Youtube or Google Drive. It can also be downloaded as WebM file.

@niqdev
niqdev / basic-sshd.go
Created December 18, 2022 17:42 — forked from protosam/basic-sshd.go
Simple ssh server example in go.
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client:
@niqdev
niqdev / sshd.go
Created December 18, 2022 17:41 — forked from jpillora/sshd.go
Go SSH server complete example - Read more here https://blog.gopheracademy.com/go-and-ssh/
// A small SSH daemon providing bash sessions
//
// Server:
// cd my/new/dir/
// #generate server keypair
// ssh-keygen -t rsa
// go get -v .
// go run sshd.go
//
// Client:
uuidgen | sha256sum | base64 | head -c 32 ; echo
@niqdev
niqdev / git-old-tag.txt
Created October 10, 2022 17:32
How to tag an older commit in git preserving the original date
git checkout <COMMIT_SHA>
GIT_COMMITTER_DATE="$(git show --format=%aD | head -1)" git tag vX.Y.Z
git push origin --tags
git checkout main
@niqdev
niqdev / README.md
Created September 22, 2022 08:58 — forked from nathabonfim59/README.md

How to fix the "Failed to close file descriptor for child process (Operation not permitted)" in your docker ci build

Disclaimer

First off, I'm not a docker expert by any means. I just wanted my CI pipeline to work and went down the habbit hole. The solution I present can cause some security implications, be aware.

Cause

The problem is caused by a seccomp policy and a glibc >= 2.34 update that returns an EPERM (operation not permitted) insted of ENOSYS (function not implemented).

Solution/Workaround

@niqdev
niqdev / stringify.sh
Last active June 23, 2021 16:51
jq stringify JSON
#cat example.json
#{
# "myKey": "myValue",
# "myArray": [
# "hello",
# "world"
# ]
#}
cat example.json | jq -c | jq -R