Skip to content

Instantly share code, notes, and snippets.

View danihodovic's full-sized avatar

Dani Hodovic danihodovic

View GitHub Profile
@danihodovic
danihodovic / main.ts
Created June 28, 2023 10:57
Obsidian command palette remap Ctrl+P / Ctrl+J
import { App, Editor, MarkdownView, Modal, Notice, Plugin, PluginSettingTab, Setting } from 'obsidian';
// Remember to rename these classes and interfaces!
interface MyPluginSettings {
mySetting: string;
}
const DEFAULT_SETTINGS: MyPluginSettings = {
mySetting: 'default'
@danihodovic
danihodovic / times.md
Last active January 5, 2021 19:20
Pyinstaller start up times

Normal

python __init__.py  0.22s user 0.02s system 100% cpu 0.240 total
python __init__.py  0.21s user 0.03s system 100% cpu 0.240 total
python __init__.py  0.22s user 0.03s system 100% cpu 0.244 total

Lazy loading via file exec (not really lazy loading)

python __init__.py 0.27s user 0.02s system 100% cpu 0.288 total
@danihodovic
danihodovic / resume.json
Last active October 7, 2019 14:54
Resume
{
"meta": {
"theme": "elegant"
},
"basics": {
"name": "Dani Hodovic",
"label": "Programmer",
"picture": "https://i.imgur.com/Ad6g3J7.jpg",
"email": "dani@honeylogic.io",
"phone": "",
@danihodovic
danihodovic / main.go
Created May 22, 2019 22:37
Barista code
// Copyright 2018 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
@danihodovic
danihodovic / delete.py
Created May 2, 2019 10:37
Delete all gitlab runners
import gitlab
import os
gitlab_client = gitlab.Gitlab(
url='https://gitlab.com',
private_token=os.getenv("GITLAB_API_PRIVATE_TOKEN"),
api_version=4
)
for runner in gitlab_client.runners.list():
@danihodovic
danihodovic / extract_terraform_vars.py
Last active October 29, 2018 10:39
Terraform vars generation
#!/usr/bin/env python3
import re
import sys
import os
usage = f'''
Prints all terraform variables in a directory. Used to generate a variables.tf
file based on variables used in resource files (var.foo, var.bar).
Usage:
@danihodovic
danihodovic / update.sh
Last active July 16, 2018 06:28
Update danihodovic/samson-ansible
#!/usr/bin/env bash
set -ev
if [ ! $# -eq 1 ]; then
echo "Usage $0 <samson-version>"
echo
echo "See Samson versions at https://hub.docker.com/r/zendesk/samson/tags/"
exit 1
fi
@danihodovic
danihodovic / app.js
Created June 25, 2018 17:36
Testing HAProxy backend DNS resolution
const http = require('http');
const os = require('os');
let num = 0;
setTimeout(() => {
console.log(os.hostname(), num);
process.exit(0);
}, 60000);
@danihodovic
danihodovic / script.py
Created June 18, 2018 10:11
Fix yamllint document start
#!/usr/bin/env python3
# Auto fixes the yamllint warning `document-start`.
# Walks all the files in the `ansible` directory and executes yamllint on
# every yaml file. If the document start error is found it prepends the
# file with `---\n`.
import os
import subprocess
from pathlib import Path
aptinstall gnutls-dev
aptinstall uuid-dev
cmake -DCMAKE_BUILD_TYPE=release .