Skip to content

Instantly share code, notes, and snippets.

View patte's full-sized avatar
🏝️

Patrick Recher patte

🏝️
View GitHub Profile
namespace :figaro do
desc "SCP transfer figaro configuration to the shared folder"
task :setup do
on roles(:app) do
upload! "config/application.yml", "#{shared_path}/application.yml", via: :scp
end
end
desc "Symlink application.yml to the release path"
task :symlink do
#!/bin/bash
# Generate a kubernetes secret for nginx
# github: patte
usage="generate a kubernetes secret for nginx
$(basename "$0") [-h] -n NAME [-c CRTPATH -k KEYPATH ] [-s] [-p HTPASSWDPATH]
where:
-h show this help text
-n NAME name of the secret and the generated file

Keybase proof

I hereby claim:

  • I am patte on github.
  • I am patte (https://keybase.io/patte) on keybase.
  • I have a public key ASAoHmQ623Seu8NC-NOmTZCkhBHiFsNruXyVBpr0hSrBLQo

To claim this, I am signing this object:

switch ctrl and caps

sudo vi /usr/share/X11/xkb/symbols/pc

make links from OSX work

sudo ln -s /home /Users

basic packages

sudo apt-get install git htop vim transmission tmux pass zsh mc sudo apt-get install kismet wireshark virtualbox gimp

as root

USERNAME=patte
SSH_PUB_KEY="ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDZ77RKQPFvL/oF0sTiNptv72z7WecByD8LBw1fXQhcXOhT1pCTplADOVuYWmuN2NVh4xO8Qk75Py8dg/XInHAX5M6qxPEwbWJvoBGhl4CgT5G1z+vdyDxLQkdW822jGK4GjhmerSWmvubTBS+zBLJ2falLjdtjsj2PlMkL4T6J6bQ6GfjuDL9rIm4ZXb6+GlgiqwuFEF0AKX4Hg6J78LiaHkb9w9cUG1j10cfv8eEmCpfm+qcDtKUCV6t2+jt69DBrFItQ+AEIqhP+d4ZgGfYslko0Kk7fOp+UVnj6GjUzJDrn3v0W+KxaDfEeEYj/Car694SRwvdsx3KxRXQomjGMkCHTgDoq0IwPClGfhTay75WKscRKm0yUWIWzsF6Rfmje81ptQveeM9azKjCnu9P177Ag6yWlDuzx3lKJnrgffbmmPSyFAL/ss0Kddh4N8AoeniRP9KyIEXmZLGMQ7Z4NEMTaCt9IG5RSy1aI14QPtiNUGq7hq9DAMjkh73LCAkJGoTIHtrH50bQnXQbpWeDEA2it0m/IWdLAQ8YacKKe16Y4vygpV9gPa9TPzdu6qW50nNhShYIFvjM3Lda5WfSg17YR4khY5xI/Q23CoZjnFAxDi5tibGQl5PL3BG5BbDXudfh3XaS+zV8XmW0vhF4VXPnmBLnMRVswZ5xfwPMnfQ== patte@Project-R.local"

useradd -s /bin/bash -G sudo -m $USERNAME
sudo -u $USERNAME mkdir /home/$USERNAME/.ssh
chmod 700 /home/$USERNAME/.ssh
echo $SSH_PUB_KEY > /home/$USERNAME/.ssh/authorized_keys
@patte
patte / Operation Grillzange.md
Last active June 22, 2018 17:01
Steps to switch the production elasticsearch server.

Operation Grillzange

Steps to switch the production elasticsearch server.

  1. Preparations

    • write down current ELASTIC_URL of republik-api
    • test on staging first
    • export / import kibana (management -> saved objects -> export everything)
@patte
patte / Operation verbrennt.md
Last active June 22, 2018 17:54
delete (pre*)publications from redis
  1. connect to redis
heroku redis:cli redis-NAME -a republik-api
  1. delete keys
EVAL "return redis.call('del', unpack(redis.call('keys', ARGV[1])))" 0 *publication

republik

  • greeting (+pubsub)
  • searches (expire 3d)
  • pubsub comment
  • pubsub webNotification

publikator

  • mailchimpCampaignId (expire 8w)
  • commits (expire 8w)
@patte
patte / fixCombiningDiaeresis.js
Created October 8, 2018 14:05
fix UTF8 combining diaeresis
//https://www.fileformat.info/info/unicode/char/0308/index.htm
//https://vi.stackexchange.com/questions/3557/can-i-search-for-a-unicode-combining-character-in-vim
const fs = require('fs')
const path = __dirname+'/article.md'
const buffer = fs.readFileSync(path)
const fixed = buffer.toString('utf8')
.replace(/a\u0308/g, 'ä')

Archive a repo history

How to archive a repo and copy the last n commits to a new one. republik/magazine is used as an example here.

Preparation

  1. Ìnstall git script rebase-from
git config --global alias.rebase-from '!b="$(git branch --no-color | cut -c3-)" ; h="$(git rev-parse $b)" ; echo "Current branch: $b $h" ; c="$(git rev-parse $1)" ; echo "Recreating $b branch with initial commit $c ..." ; git checkout --orphan new-start $c ; git commit -C $c ; git rebase --onto new-start $c $b ; git branch -d new-start ; git reflog expire --expire=all ; git gc --prune=all'