Skip to content

Instantly share code, notes, and snippets.

{{ range $port_map := .PROXY_PORT_MAP | split " " }}
{{ $port_map_list := $port_map | split ":" }}
{{ $scheme := index $port_map_list 0 }}
{{ $listen_port := index $port_map_list 1 }}
{{ $upstream_port := index $port_map_list 2 }}
server {
{{ if eq $scheme "http" }}
listen [::]:{{ $listen_port }} default_server;
listen {{ $listen_port }} default_server;
require "i18n"
I18n.backend = I18n::Backend::KeyValue.new({})
I18n.backend.store_translations(:en, { test: "Hello %{value}" }, escape: false)
module I18nSafeTranslations
def translate(*args)
super
rescue I18n::MissingInterpolationArgument => e
# Raven.capture_exception(e) # send to Sentry
@ebeigarts
ebeigarts / dokku-reip.sh
Last active March 27, 2017 12:12
dokku-reip.sh
for APP in `dokku apps | grep -v '=====> My Apps'`; do
ID=$(cat /home/dokku/$APP/CONTAINER.web.1)
IP=$(docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $ID)
if [ ! -z $IP ]; then
echo " ---> $APP: $IP"
echo $IP > /home/dokku/$APP/IP.web.1
dokku nginx:build-config $APP
fi
done
#!/bin/bash
exec >> /var/log/backup.log 2>&1
set -ex
/usr/local/avamar/etc/scripts/post.sh
echo "pre.sh"
date
#!/bin/bash
exec >> /var/log/backup.log 2>&1
set -ex
echo "post.sh"
date
if [ -e /tmp/dump.pids ]; then
for PID in `cat /tmp/dump.pids`; do
#!/bin/bash
send-message() {
local message=$(echo "$@" \
| sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[mGK]//g" \
| sed 's/\\/\\\\/g' \
| sed 's/"/\\"/g' \
| sed "s/'/\\'/g")
echo $message
json="{ \"text\": \"$message\" }"
@ebeigarts
ebeigarts / README.md
Last active September 14, 2017 22:46
Dokku redeploy fix

Rebuild dokku nginx configuration with correct container IP addresses after system reboot until #2736 is released.

sudo curl -L -o /etc/systemd/system/dokku-redeploy-fix.service https://gist.github.com/ebeigarts/e3256021986f625acec62d9add04dfc3/raw/d85afd4e8beba843e273f4c8b7237c375a7eabea/dokku-redeploy-fix.service &&
sudo curl -L -o /usr/bin/dokku-redeploy-fix https://gist.github.com/ebeigarts/e3256021986f625acec62d9add04dfc3/raw/b4b3be7f3fdf51ba4e7716ac8cf04f40b97a762b/dokku-redeploy-fix.sh &&
sudo chmod +x /usr/bin/dokku-redeploy-fix &&
sudo systemctl enable dokku-redeploy-fix
@ebeigarts
ebeigarts / mikrotik-chateau-cell-lock.txt
Created August 28, 2021 18:00 — forked from mrskug/mikrotik-chateau-cell-lock.txt
Mikrotik Chateau LTE cell lock described. Saved for posterity, in case forum post gets deleted.
https://forums.quectel.com/t/eg12-and-freq-or-cell-lock-feature/4619
thanks.
After many test I discover all stuff.
This is example at RouterBoard Chateau, RouterOS 7 beta 8
Quectel EG12 not support frequency lock to select band at any tower.
Quectel EG12 support one and many Cell Lock’s, you can enter max 20 of CellLock’s and it select the one with the best signal and set it as primary-band.
#!/bin/bash
set -ex
rsvg-convert $1 -z 4 -o /tmp/temp.png
~/Downloads/vtracer-mac-arm64 -c 32 --mode spline --preset poster \
--input /tmp/temp.png \
--output /tmp/temp.svg