Skip to content

Instantly share code, notes, and snippets.

Edgars Beigarts ebeigarts

Block or report user

Report or block ebeigarts

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@ebeigarts
ebeigarts / README.md
Last active Sep 14, 2017
Dokku redeploy fix
View README.md

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
View -
#!/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\" }"
View post.sh
#!/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
View pre.sh
#!/bin/bash
exec >> /var/log/backup.log 2>&1
set -ex
/usr/local/avamar/etc/scripts/post.sh
echo "pre.sh"
date
@ebeigarts
ebeigarts / dokku-reip.sh
Last active Mar 27, 2017
dokku-reip.sh
View 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
View i18n_safe.rb
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
View -
-- Logs begin at Tue 2017-01-03 17:55:44 EET, end at Thu 2017-03-16 17:40:41 EET. --
Jan 03 17:56:00 intranet dockerd[508]: time="2017-01-03T17:56:00.287805859+02:00" level=info msg="libcontainerd: new containerd process, pid: 1273"
Jan 03 17:56:03 intranet dockerd[508]: time="2017-01-03T17:56:03.450218694+02:00" level=info msg="[graphdriver] using prior storage driver \"aufs\""
Jan 03 17:56:16 intranet dockerd[508]: time="2017-01-03T17:56:16.594641647+02:00" level=info msg="Graph migration to content-addressability took 0.00 seconds"
Jan 03 17:56:16 intranet dockerd[508]: time="2017-01-03T17:56:16.594914381+02:00" level=warning msg="Your kernel does not support cgroup memory limit"
Jan 03 17:56:16 intranet dockerd[508]: time="2017-01-03T17:56:16.594958775+02:00" level=warning msg="Your kernel does not support cgroup cfs period"
Jan 03 17:56:16 intranet dockerd[508]: time="2017-01-03T17:56:16.594979332+02:00" level=warning msg="Your kernel does not support cgroup cfs quotas"
Jan 03 17:56:16 intranet dockerd[5
View -
{{ 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;
View instrument_template_resolver.rb
if Rails.env.development?
ActionView::PathSet.class_eval do
private
alias_method :__find_all, :_find_all
def _find_all(*args)
t1 = Time.now
__find_all(*args)
ensure
t2 = Time.now
Thread.current["find_template_time"] ||= 0
View keybase.md

Keybase proof

I hereby claim:

  • I am ebeigarts on github.
  • I am ebeigarts (https://keybase.io/ebeigarts) on keybase.
  • I have a public key whose fingerprint is A14B 0A98 2061 C331 E4D8 C62B BD92 D3E2 0910 B700

To claim this, I am signing this object:

You can’t perform that action at this time.