Skip to content

Instantly share code, notes, and snippets.

@mr-karan
mr-karan / deployment.hcl
Last active December 26, 2023 10:30
Single Node nomad and consul
job "hello-world" {
datacenters = ["dc1"]
namespace = "default"
type = "service"
group "redis" {
# Specify number of replicas of redis needed.
count = 1
# Specify networking for the group, port allocs.
@sts10
sts10 / rust-command-line-utilities.markdown
Last active July 21, 2024 11:17
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
@oskaralmlov
oskaralmlov / ansible-args.md
Created September 18, 2021 13:32
ansible-args-keyword

Most Ansible users have come across the args keyword when using the ansible.builtin.command module. In this case the args keyword is used to pass a named parameter such as chdir or creates to the module that accepts a "free form" parameter.

Example:

- ansible.builtin.command: touch filename #Run this command
  args:
    chdir: /some/path            # Change to this path before running command
    creates: /some/path/filename # The command creates this file

What you might not know is that the args keyword can be used on any module for a number of different use cases . Here are some examples:

@sinbad
sinbad / backup_gitea.sh
Created August 9, 2020 14:58
My Gitea Backup & Restore Scripts
#!/bin/bash
# `gitea dump` doesn't currently back up LFS data as well, only git repos
# It primarily backs up the SQL DB, and also the config / logs
# We'll backup like this:
# * "gitea dump" to backup the DB and config etc
# * tar / bzip all the repos since they will be skipped
# * Not rotated because git data is immutable (normally) so has all data
# * rsync LFS data directly from /volume/docker/gitea/git/lfs
# * No need for rotation since all files are immutable
apt update
apt install -y pgxnclient
pgxn install pg_repack
#You need to install postgresql-server-dev-X.Y for building a server-side extension or libpq-dev for building a client-side application.
apt install -y postgresql-server-dev-9.5
apt install -y ca-certificates
apt install -y build-essential
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active July 22, 2024 17:46
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized

Modern JavaScript: A (Brief) Overview

Lunch&Learn | 2019-03-26

What's new in modern JavaScript?

Modules

To make a module's (i.e. a script's) methods or variables useable by another module, export them:

@nileshsimaria
nileshsimaria / docker-default-directory
Last active June 25, 2024 07:32
Change docker's default /var/lib/docker to different directory on Ubuntu
1. Take a backup of docker.service file.
$ cp /lib/systemd/system/docker.service /lib/systemd/system/docker.service.orig
2. Modify /lib/systemd/system/docker.service to tell docker to use our own directory
instead of default /var/lib/docker. In this example, I am using /p/var/lib/docker
Apply below patch.
$ diff -uP -N /lib/systemd/system/docker.service.orig /lib/systemd/system/docker.service
--- /lib/systemd/system/docker.service.orig 2018-12-05 21:24:20.544852391 -0800
@gaearon
gaearon / modern_js.md
Last active July 18, 2024 10:37
Modern JavaScript in React Documentation

If you haven’t worked with JavaScript in the last few years, these three points should give you enough knowledge to feel comfortable reading the React documentation:

  • We define variables with let and const statements. For the purposes of the React documentation, you can consider them equivalent to var.
  • We use the class keyword to define JavaScript classes. There are two things worth remembering about them. Firstly, unlike with objects, you don't need to put commas between class method definitions. Secondly, unlike many other languages with classes, in JavaScript the value of this in a method [depends on how it is called](https://developer.mozilla.org/en-US/docs/Web/Jav
@jesugmz
jesugmz / Dockerfile
Last active October 23, 2021 21:25
Example how to build Docker multi-stage image using official PHP and Composer images
ARG PHP_VERSION=7.2-fpm-stretch
ARG COMPOSER_VERSION=latest
# builder stage
FROM php:$PHP_VERSION AS builder
ARG AMQP_VERSION=1.9.3
ARG PHPREDIS_VERSION=4.1.1
RUN apt-get update && apt-get install -y --no-install-recommends --no-install-suggests \