Skip to content

Instantly share code, notes, and snippets.

Daniel Hilst dhilst

Block or report user

Report or block dhilst

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
dhilst /
Created Apr 7, 2019
Create open objects with easy, access dicts as objects and arrays with a simple notation
from import MutableMapping
class O(MutableMapping):
O class make possible to create deep nested objects without struggle.
Just instantiate it!
>>> o = O()
It's represented by its contructor. This means that coping and pasting
dhilst / gist:f5d5d78463f34d243d7f343337f8880b
Last active Apr 7, 2019
Show queries at rails test console
View gist:f5d5d78463f34d243d7f343337f8880b
ActiveRecord::Base.logger =
dhilst /
Last active Apr 7, 2019
declarative class expressinons
# Using class expressions for declarative programming in python
import inspect
def route(path, func, *methods):
An example on how to create function usable for
declarative programming in python. These functions
will sit on the class body and setup some state for
latter use.
dhilst / gist:43e13b93f68811988324fa4f483cce75
Last active Jan 25, 2019
Redmine Uninstall agile plugin
View gist:43e13b93f68811988324fa4f483cce75
# Move all issues to 'Task' tracker
RAILS_ENV=production rails r "Issue.where(tracker: Tracker.find_by(name: 'User story'))&.update(tracker: Tracker.find_by(
name: 'Task'))"
bundle exec rake redmine:plugins:migrate NAME=redmine_agile VERSION=0 RAILS_ENV=production
rm -rf plugins/redmine_agile/
# Update Fedora
is_number() { perl -se 'exit($n !~ /^\d+(\.\d+)?$/)' -- -n="$1"; }
current_version=$(curl -s | perl -lane 'print $1 if /href="(\d+)\/"/' | sort -rn | head -1)
is_number $current_version || { echo 'Cant get Fedora version'; exit 1; }
dnf install dnf-plugin-system-upgrade -y && dnf upgrade --refresh -y && dnf system-upgrade download --refresh --releasever=$current_version -y && dnf system-upgrade reboot -y
View gist:73b701c753f13301bc3610aaefba18a8
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/daniel/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See
View gist:43a1aa12737d279b2f416f0802e2c494
set modeline
set ls=2
set autoindent smartindent clipboard+=unnamed
set formatoptions-=t formatoptions+=croql
set nohls
set synmaxcol=200
set et
set backspace=indent,eol,start
set mouse+=a
set fo+=crot
dhilst / deletecache.js
Created Oct 28, 2018
Delete all service workers cache on liner
View deletecache.js
window.caches.keys().then(ks => ks.forEach(k => window.caches.delete(k).then(console.log).catch(console.error)))
View schema_list_fk.sql
SELECT sql sql, type type, tbl_name tbl_name, name name
FROM sqlite_master
SELECT sql, type, tbl_name, name
FROM sqlite_temp_master
WHERE type != 'meta'
View .tmux.conf
# 0 is too far from ` ;)
set -g base-index 1
# Automatically set window title
set-window-option -g automatic-rename on
set-option -g set-titles on
#set -g default-terminal screen-256color
set -g status-keys vi
set -g history-limit 10000
You can’t perform that action at this time.