Skip to content

Instantly share code, notes, and snippets.

Oh my zsh.

Oh My Zsh

Install ZSH.

sudo apt install zsh-autosuggestions zsh-syntax-highlighting zsh

Install Oh my ZSH.

@roberthamel
roberthamel / docker-swarm-gpu.md
Created November 4, 2022 18:02 — forked from tomlankhorst/docker-swarm-gpu.md
Instructions for Docker swarm with GPUs
@roberthamel
roberthamel / code.sh
Created October 3, 2022 12:28 — forked from tallguyjenks/code.sh
ZettelKasten Sync Code
# To permanently cache the credentials
git config --global credential.helper store
# To ignore files that could cause issues across different workspaces
touch .gitignore
echo ".obsidian/cache
.trash/
.DS_Store" > .gitignore
@roberthamel
roberthamel / main.go
Created May 26, 2022 02:49
golang download progress
// https://golangcode.com/download-a-file-with-progress/
package main
import (
"fmt"
"io"
"net/http"
"os"
"strings"
@roberthamel
roberthamel / dnsmasq OS X.md
Created May 20, 2022 03:48 — forked from ogrrd/dnsmasq OS X.md
Setup dnsmasq on OS X

Never touch your local /etc/hosts file in OS X again

To setup your computer to work with *.test domains, e.g. project.test, awesome.test and so on, without having to add to your hosts file each time.

Requirements

Install

@roberthamel
roberthamel / full_upsert.py
Last active May 18, 2022 19:44 — forked from nirizr/full_upsert.py
sqlalchemy upsert
def upsert(session, model, rows):
table = model.__table__
stmt = postgresql.insert(table)
primary_keys = [key.name for key in inspect(table).primary_key]
update_dict = {c.name: c for c in stmt.excluded if not c.primary_key}
if not update_dict:
raise ValueError("insert_or_update resulted in an empty update_dict")
stmt = stmt.on_conflict_do_update(index_elements=primary_keys,
@roberthamel
roberthamel / rancher-docker.sh
Created January 9, 2021 15:42
rancher-docker
docker run -d --restart=unless-stopped \
--name rancher \
-p 80:80 -p 443:443 \
-v $HOME/srv/rancher:/var/lib/rancher \
--privileged \
rancher/rancher
@roberthamel
roberthamel / uninstall-k3s.sh
Created December 22, 2020 15:49
uninstall k3s
#!/usr/bin/env bash
set -euo
k3s-uninstall.sh
docker container kill $(docker ps -q)
@roberthamel
roberthamel / docker-compose.yml
Created February 4, 2020 05:20 — forked from tobydeh/docker-compose.yml
gitea 1.10, drone 1.6 and drone-runner-docker example using docker-compose
# Instructions
# 1. Update your /etc/hosts file...
# > 127.0.0.1 gitea drone
# 2. Run gitea + gitea-db and generate the oauth application
# > docker-compose -p gitea-drone up gitea gitea-db
# - Navigate to http://gitea:3000 to finish the installation and register a user
# - Create a oauth application as described here: https://docs.drone.io/installation/providers/gitea/
# - Set the Redirect uri to http://drone:8000/login
# 3. Update the docker-compose file with the client_id and client_secret
# 4. Fire up all of the services
@roberthamel
roberthamel / README.md
Created February 3, 2020 04:11 — forked from joffilyfe/README.md
GITEA + Drone (0.7|0.8)

Compose file to setup and host a Gitea and Drone environment

This environment is dependent off a common network for docker/git plugin and gitea-server, so for this work fine in closed networks we have to create a custom network before run this composefile.

First create your network:

docker network create gitea-network