Skip to content

Instantly share code, notes, and snippets.

@eklex
eklex / 80-mount-usb-to-media-by-label.rules
Last active July 9, 2024 09:09
udev rule for Home Assistant OS (hassio) to mount USB drives into the Supervisor Media directory
#
# udev rule
# Mount USB drive to the media directory using the partition name as mount point
#
# Description:
# Created for Home Assistant OS, this rule mounts any USB drives
# into the Hassio media directory (/mnt/data/supervisor/media).
# When a USB drive is connected to the board, the rule creates one directory
# per partition under the media directory. The newly created partition is named
# as the partition name. If the partition does not have a name, then the following
@ivanmorenoj
ivanmorenoj / dynamic-tunnel@.service
Last active May 5, 2023 09:07
Systemd template for local ssh port forwarding at startup
[Unit]
Description=Setup a dynamic tunnel to %I
After=network.target
[Service]
EnvironmentFile=/etc/default/dynamic-tunnel@%i
ExecStart=/usr/bin/ssh -i ${PATH_TO_KEY} -o ServerAliveInterval=60 -o ExitOnForwardFailure=yes -nNT -D ${LOCAL_PORT} ${REMOTE_USER}@${REMOTE_HOST}
RestartSec=15
Restart=always
KillMode=mixed
@ArturT
ArturT / main.yaml
Last active November 9, 2022 06:10
GitHub Actions - how to run parallel tests in RSpec for Ruby on Rails project. See article how to run RSpec on GitHub Actions for Ruby on Rails app using parallel jobs https://docs.knapsackpro.com/2019/how-to-run-rspec-on-github-actions-for-ruby-on-rails-app-using-parallel-jobs or sign up at https://knapsackpro.com/?utm_source=github&utm_medium=…
# .github/workflows/main.yaml
name: Main
on: [push]
jobs:
test:
runs-on: ubuntu-latest
# If you need DB like PostgreSQL, Redis then define service below.
@neomantra
neomantra / High_Performance_Redis.md
Last active July 12, 2024 07:55
Notes on running Redis with HPC techniques

High Performance Redis

In response to this brief blog entry, @antirez tweeted for some documentation on high-performance techniques for Redis. What I present here are general high-performance computing (HPC) techniques. The examples are oriented to Redis. but they work well for any program designed to be single- or worker-threaded and asynchronous (e.g. uses epoll).

The motivation for using these techniques is to maximize performance of our system and services. By isolating work, controlling memory, and other tuning, you can achieve significant reduction in latency and increase in throughput.

My perspective comes from the microcosm of my own bare-metal (vs VM), on-premises deployment. It might not be suitable for all scenarios, especially cloud deployments, as I have little experience with HPC there. After some discussion, maybe this can be adapted as [redis.io documentation](https://redis.io/do

Email - (?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])
SSN - ^(?!(000|666|9))\d{3}-(?!00)\d{2}-(?!0000)\d{4}$|^(?!(000|666|9))\d{3}(?!00)\d{2}(?!0000)\d{4}$
Passport Number - ^(?!^0+$)[a-zA-Z0-9]{3,20}$
Date of Birth - ^((?:0[0-9])|(?:[1-2][0-9])|(?:3[0-1]))/((?:0[1-9])|(?:1[0-2]))/((?:19|20)\d{2})$
Credit Cards - ^(?:4[0-9]{12}(?:[0-9]{3})? # Visa
| (?:5[1-5][0-9]{2} # MasterCard
@ansemjo
ansemjo / gitlab-backup-to-minio.md
Last active March 5, 2024 23:30
upload gitlab omnibus backups to minio

setup Minio somewhere

Minio is an object storage server compatible with the S3 protocol. Head to https://minio.io/ to learn more.

Hint: You might want to use MINIO_WORM=on to pretect against accidental or malicious deletion of your backups.

seperate users with iam policies

Since RELEASE.2018-10-18T00-28-58Z minio supports seperate users with attached IAM policies. Instead of (or additionally to) using MINIO_WORM=on you could create a new user and attach a writeonly policy:

@hadisfr
hadisfr / outline-server-setup.md
Last active June 14, 2024 21:04 — forked from okeehou/outline-server-setup.md
How to setup an Outline VPN Server on Ubuntu 16.04

How to setup an Outline VPN Server on Ubuntu 16.04 Server

This guide will show you how to install Outline Server on an Ubuntu 16.04 Server and use Outline Manager.

Install Outline Manager

Outline Manager supports Windows, macOS and Linux.

Outline Manager for Windows

@rlex
rlex / gist:2ec8562c4642032600e3e4c8a5acac4b
Created April 4, 2018 13:42
Mikrotik <-> Linux GRE/IPSec, strongswan
config setup
charondebug="ike 2, knl 2, cfg 2, net 2, esp 2, dmn 2, mgr 2"
conn %default
# keyexchange=ikev2
conn mikrotik-1
# Try connect on daemon start
auto=start
@evianzhow
evianzhow / hp_saap_license.txt
Created September 3, 2017 02:11
HP Smart Array Advanced Pack Evaluation License Key
34T62-N84MB-7DQGY-G7XGT-YTQ63
@chuikoaleksandr
chuikoaleksandr / JIRA transition.groovy
Last active May 6, 2020 16:59
ScriptRunner for JIRA
import com.atlassian.jira.component.ComponentAccessor
def doTransition(issue, int actionId, user){
def issueService = ComponentAccessor.getIssueService()
def issueInputParameters = issueService.newIssueInputParameters();
def transitionValidationResult = issueService.validateTransition(user, issue.id, actionId, issueInputParameters);
if (transitionValidationResult.isValid()){
issueService.transition(user, transitionValidationResult);
return true
} else {