Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View jenrik's full-sized avatar
🐧

Jener Rasmussen jenrik

🐧
View GitHub Profile
@jenrik
jenrik / utime.sh
Last active March 7, 2023 19:08
Multifunction timestamp tool
function utime()
{
if [ $# = 1 ] && ([ "${1:0:1}" = "+" ] || [ "${1:0:1}" = "-" ]) && [ "$1" != "--help" ]
then
# Do date math
date -d "$1" "+%s"
elif [ $# = 1 ] && (echo "$1" | grep -P "^[[:digit:]]+$" > /dev/null)
then
# Convert timestamp to human-readable date
date -d "@$1" || help
@jenrik
jenrik / cloud-init.yaml
Last active November 21, 2021 22:08
Rancher Ubuntu 20.04 cloud-init
#cloud-config
groups:
- docker
users:
- default
- name: ubuntu
ssh-authorized-keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCvu0XjgnnODcPW2/g2A63Q9L8nKO1LHx5xAdGEa+YH6SPJYncGYGoW2CfckwnQYPYy1vdWli1ZDnvtn0WIpUIRbyp06aQzX7+Iq/hoae0iRcSYXwRlBgAnYzATmXk7Vby/C5oX8yqoTlmSSjkbynRePLm4xvUoPjDir9Lct6xKeeb0hhJgmc4fByEwgP8LD6MjnViuLHjezScqbgfmKnl4bBVfJIJaOm3IGY4/ps2nH3zPVq1rtFkwqKKSjN374GQ6c8DW1+uBib4SfX8UplLCHt66bsrEZLlTfbYoOAdanbgar9OuzjveENa8wTnj3vON8OW5GhmrOhwPt8CfsOoXTbjM87zPnXkFkg1OS+QuEkwtM3y2KcFKE0ME/tHdBZekkII7NqpUn9WvWoDk+HexeIgfm9ZAgkywdcrObLlCqHreQKTuz5f7gDnUgq7fpYueMc6u03x5gsdVVpszuQwH7YjajD+8YATMsCjP8c85EKL0Nzhs2nSOzL/hMxUm9g6kw4uUXAP3wql7Qf4i24NVWmtd8QXABjXMSYzXw3Xf7619Q3/YadLCiDmmi5ArQjNtIwuL19OHNMjLobvOVIXnksGqABfpkOd9EXKRxCI9sWKb+tmvzAAX+T50l2TSfgdL/dwQIUXkasd8ZpIjXQqOmTh/hegVYtr1Bv0x+vMORQ==
sudo: ALL=(ALL) NOPASSWD:ALL
groups: sudo, docker
@jenrik
jenrik / index.php
Last active June 20, 2019 18:00
Cron script for updating ssh key from Github periodically, and logging which servers fetches keys
<?php
$github = "jenrik";
$dbhost = "";
$dbname = "";
$dbuser = "";
$dbpass = "";
header("Cache-control: private, max-age=0, no-cache");
@jenrik
jenrik / cores.py
Last active July 1, 2019 10:03
Enable/Disable a number of cores on a Linux system
#!/usr/bin/env python3
import sys
MAX_CORES = 12
if len(sys.argv) >= 2:
n = int(sys.argv[1])
if n > MAX_CORES or n < 1:
sys.exit(1)
#!/bin/sh
# Generate front+back mill + cut gcode
#
# zwork is set at 0.0. Adjust z-coordinate after touch off (e.g. to 0.1/0.2 mm) to cut below surface.
# (0.0 is usually a bit shallow if touched of on contact)
#
# zcut is set at just -1.4 mm to avoid cutting into and damaging material below
#
# cutter-diameter is 3.0 mm for 3.0 mm fishtail tool. Can be changed to 1.6 mm for 30 degree V-bit.
#
@jenrik
jenrik / README.md
Created January 31, 2019 22:55
Guide to using bumblebee inside a flatpak

WORK IN PROGRESS, NOT FULLY TESTED YET

Setup flatpak

  1. Install bumblebee
  2. set KeepUnusedXServer to true in /etc/bumblebee.conf
  3. Acquire a copy of primus libgl.so either from your package manager or by compiling from source
  4. Copy the primus libgl.so to a folder a empty folder inside the flatpak
  5. Acquire a copy of the primusrun script either from your package manager or from https://github.com/amonakov/primus/blob/master/primusrun
  6. Copy the primusrun script to your home directory inside the flatpak
@jenrik
jenrik / rm_pkg.sh
Last active January 31, 2017 08:02
A utility for removing packages on Mac OS X
#!/bin/bash
# Usage: rm_pkg.sh com.example.app
# Find packages names with "pkgutil --pkgs"
set -e
set -x
OLD_PWD=$(pwd)
PKG=$1
cd "$(pkgutil --pkg-info $PKG | grep volume | cut -c9-)"
cd "$(pkgutil --pkg-info $PKG | grep location | cut -c11-)"
@jenrik
jenrik / designer.html
Last active March 31, 2016 13:51
designer
<link rel="import" href="../paper-button/paper-button.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
width: 80%;
height: 100%;
@jenrik
jenrik / README.md
Created September 21, 2015 14:34
Danish support in lunr.js

This library contains a danish word stemmer and stopword list for lunr.js. You use this library by including it in a script tag after the lunr.js script tag.

@jenrik
jenrik / PKGBUILD
Created June 3, 2015 19:24
PKGBUILD for Guake 0.7.2 with the keybinder patch
# $Id$
# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Angel Velasquez <angvp@archlinux.org>
# Contributor: Wilson Pinto Júnior (N3RD3X) <n3rd3x@linuxmail.org>
# Contributor: Attila Bukor <r1pp3rj4ck@w4it.eu>
pkgname=guake
pkgver=0.7.2.1
pkgrel=1
pkgdesc='Drop-down terminal for GNOME'