Skip to content

Instantly share code, notes, and snippets.

@andreaseger
andreaseger / backup.sh
Created May 22, 2022 14:32
incremental system backup via rsync
#!/bin/bash
# Title: Incremental Back-up script
# Description: Create back-ups of dirs and dbs by copying them to Perfacilis' back-up servers
# We strongly recommend to put this in /etc/cron.hourly
# Version: 0.5
# Usage: bash /etc/cron.hourly/backup
readonly BACKUP_LOCAL_DIR=/ext/local-backup
readonly BACKUP_DIRS=(/etc /home /ext $BACKUP_LOCAL_DIR)
@andreaseger
andreaseger / example.rb
Created January 20, 2021 15:40
memory example
#!/usr/bin/env ruby
@list = []
allocate_memory = 50
Thread.new {
counter = 0
loop do
if counter > 15
@list = []
#!/usr/bin/env bash
set -e
pushd ~/bin
rm VSCode-linux-x64.old/ -rf
mv VSCode-linux-x64 VSCode-linux-x64.old
wget "https://go.microsoft.com/fwlink/?LinkId=723968" -O vscode-insider.tar.gz
tar -xzf vscode-insider.tar.gz
ln -sf ~/bin/VSCode-linux-x64/bin/code-insiders ~/.local/bin/code
popd

Keybase proof

I hereby claim:

  • I am andreaseger on github.
  • I am egera (https://keybase.io/egera) on keybase.
  • I have a public key ASDKb_dYVs6dIIslEsn43ndpU2B-2xY2dVHwfIkcfAWSjwo

To claim this, I am signing this object:

@andreaseger
andreaseger / nest_array_test.rb
Created June 19, 2017 11:43
list of arrays to nested hash tree
require 'bundler/inline'
gemfile do
source 'https://rubygems.org'
gem 'minitest', require: false
end
require 'minitest/autorun'
module DeepMerge
defmodule DynamicRoutingTest do
use ExUnit.Case
doctest DynamicRouting
test "match" do
:routes = :ets.new(:routes, [:named_table, :bag, :public])
method = :get
service = :articles
[["v1", "users"],
["v2", "users"],
@andreaseger
andreaseger / init_dot_files.sh
Created December 8, 2016 00:05
script to init my dot-files
git clone https://github.com/andreaseger/dot-files /tmp/dot-files --no-checkout
mv /tmp/dot-files/.git ~/.git
rm /tmp/dot-files -rf
cd ~
git reset HEAD
git checkout .
git submodule update --init
require 'bundler/inline'
gemfile true do
gem 'dry-types'
end
include Dry::Types.module
class A < Dry::Types::Struct
attribute :a, Strict::Int
end
#!/usr/bin/env ruby
require "bundler/inline"
gemfile true do
source "https://rubygems.org"
gem "dry-validation", github: "dry-rb/dry-validation"
end
module Types
include Dry::Types.module
require 'bundler/inline'
gemfile true do
source "https://rubygems.org"
gem 'msgpack'
end
puts "#" * 90
puts "#{RUBY_ENGINE} #{RUBY_VERSION} #{RUBY_PLATFORM}"
puts "MessagePack::VERSION: #{MessagePack::VERSION}"