Skip to content

Instantly share code, notes, and snippets.

View ictus4u's full-sized avatar
🚀

Walter Gomez ictus4u

🚀
View GitHub Profile
@ictus4u
ictus4u / run.tpl
Last active March 22, 2024 21:50 — forked from efrecon/run.tpl
`docker inspect` template to regenerate the `docker run` command that created a container
docker run \
--name {{printf "%q" .Name}} \
{{- with .HostConfig}}
{{- if .Privileged}}
--privileged \
{{- end}}
{{- if .AutoRemove}}
--rm \
{{- end}}
{{- if .Runtime}}
#!/usr/bin/env bash
TMATE_URL=https://github.com/tmate-io/tmate/releases/download/2.4.0/tmate-2.4.0-static-linux-amd64.tar.xz
VERSION_FILENAME=$(basename -s .tar.xz "${TMATE_URL}")
DEPLOY_DIR=/opt/tmate
sudo mkdir -p /opt/tmate
cd /opt/tmate
sudo curl -RLOJ "${TMATE_URL}"
sudo tar -xJvf "${VERSION_FILENAME}.tar.xz"
sudo ln -sf "${DEPLOY_DIR}/${VERSION_FILENAME}/tmate" "/usr/local/bin/tmate"
@ictus4u
ictus4u / api_backends.conf
Created June 18, 2020 15:59 — forked from nginx-gists/api_backends.conf
Deploying NGINX Plus as an API Gateway, Part 1
upstream warehouse_inventory {
zone inventory_service 64k;
server 10.0.0.1:80;
server 10.0.0.2:80;
server 10.0.0.3:80;
}
upstream warehouse_pricing {
zone pricing_service 64k;
server 10.0.0.7:80;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@ictus4u
ictus4u / add-non-root-user.txt
Created July 8, 2020 13:29
Dockerfile snippets
ARG USERNAME=user-name-goes-here
ARG USER_UID=1000
ARG USER_GID=$USER_UID
# Create the user
RUN groupadd --gid $USER_GID $USERNAME \
&& useradd --uid $USER_UID --gid $USER_GID -m $USERNAME \
#
# [Optional] Add sudo support. Omit if you don't need to install software after connecting.
&& apt-get update \
@ictus4u
ictus4u / gitlab.py
Created August 7, 2020 06:51 — forked from sbz/gitlab.py
gitlab: list your groups and projects using api v3
#!/usr/bin/env python
import os
import requests
import subprocess
import sys
from pprint import pprint as pp
TOKEN = 'YOUR_TOKEN'
@ictus4u
ictus4u / fix_agent_forwarding_mosh.md
Last active July 18, 2021 23:58
Fix agent forwarding inside a mosh session

Mosh doesn't provide proper support for agent forwarding, generating error messages like this one:

Permission denied (publickey)

in response to a git clone.

For adressing the issue, follow bellow steps:

  1. Open an separate SSH session with agent forwarding enabled in another terminal: ssh -A user@server
  2. In your mosh session execute the given command for setting SSH_AUTH_SOCK to the last created ssh-agent socket:
@ictus4u
ictus4u / whatsapp-hyperlink.md
Last active August 21, 2020 06:02
how to make a whatsapp hyperlink html
#!/usr/bin/env bash
jq -r '.dependencies,.devDependencies|keys[] as $k|"\($k)@\(.[$k])"' package.json | while read line; do \
printf "$line: "
[ "$(npm show "$line" | grep -ic 'DEPRECATED')" != "0" ] && \
printf "\e[1;31m""DEPRECATED\n""\e[0m" || \
printf "\e[1;32m""not deprecated.\n""\e[0m"
done
@ictus4u
ictus4u / .gitlab-ci.yml
Created September 29, 2020 15:49 — forked from florentchauveau/.gitlab-ci.yml
GitLab CI yaml file for building docker images
# This is a GitLab CI configuration to build the project as a docker image
# The file is generic enough to be dropped in a project containing a working Dockerfile
# Author: Florent CHAUVEAU <[email protected]>
# Mentioned here: https://blog.callr.tech/building-docker-images-with-gitlab-ci-best-practices/
# do not use "latest" here, if you want this to work in the future
image: docker:18
stages:
- build