Skip to content

Instantly share code, notes, and snippets.

@bivald
bivald / hide-fixed-on-zoom.html
Last active December 21, 2015 20:49
Hide a fixed element (navigation/menu) on zoom (so iOS doesn't distort or alter the menu). iOS could use gesture as well, but touch *should* work better for Android as well. UPDATE: Haven't tried Android, so added an if iOS check
<!DOCTYPE html>
<!--[if lt IE 7]> <html class="lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
<!--[if IE 7]> <html class="lt-ie9 lt-ie8"> <![endif]-->
<!--[if IE 8]> <html class="lt-ie9"> <![endif]-->
<!--[if gt IE 8]><!--> <html> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Never Denim</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
xen-create-image --hostname site.se --ip XX.XX.X.XXX --dist wheezy --dir /home/xen --memory 512Mb --size 15gb --swap 1024Mb --gateway XX.XX.XX.XX --netmask 255.255.255.0 --passwd --role=udev --accounts --vifname=yourdomain --vcpus=1
--- /home/niklas/xen/xen-unpatched/xen/tools/ioemu-remote/hw/xen_disk.c 2013-11-28 13:22:15.000000000 +0100
+++ /home/niklas/xen/xen/tools/ioemu-remote/hw/xen_disk.c 2013-11-27 11:59:23.000000000 +0100
@@ -116,6 +116,31 @@
/* ------------------------------------------------------------- */
+static void ioreq_reset(struct ioreq *ioreq)
+{
+ memset(&ioreq->req, 0, sizeof(ioreq->req));
+ ioreq->status = 0;
import flask
import jinja2
app = flask.Flask(__name__)
my_loader = jinja2.ChoiceLoader([
app.jinja_loader,
jinja2.FileSystemLoader('/path/to/extra/templates'),
])
app.jinja_loader = my_loader
@bivald
bivald / prioritize-ipv4.sh
Created January 27, 2014 13:58
Prioritize ipv4 over ipv6
echo 'precedence ::ffff:0:0/96 100' >> /etc/gai.conf
@bivald
bivald / htpasswd.py
Created April 25, 2016 08:04 — forked from eculver/htpasswd.py
htpasswd script in python (no need to install apache utils)
#!/usr/bin/env python
"""Replacement for htpasswd"""
# Original author: Eli Carter
import os
import sys
import random
from optparse import OptionParser
# We need a crypt module, but Windows doesn't have one by default. Try to find
@bivald
bivald / safe_format_and_mount.sh
Created September 30, 2016 10:23
safe_format_and_mount
#! /bin/bash
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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
@bivald
bivald / tech-positions-at-enplore.md
Created March 9, 2017 16:39
Tech positions at Enplore

Tech positions at Enplore

My name is Niklas Bivald and I'm the CTO at Enplore. If you’re applying for any kind of tech job at Enplore odds are that I will be your manager. Here's a few things you might want to know,

About us:

  • Curiosity might have killed the cat, but it's essential to everything we do.
  • We’re a small company and we work closely together
  • We use a transparent salary ladder to combat wage gaps
@bivald
bivald / rsync-retry.sh
Last active August 2, 2017 13:23 — forked from iangreenleaf/rsync-retry.sh
rsync with retries
#!/bin/bash
### ABOUT
### Runs rsync, retrying on errors up to a maximum number of tries.
### Simply edit the rsync line in the script to whatever parameters you need.
# Trap interrupts and exit instead of continuing the loop
trap "echo Exited!; exit;" SIGINT SIGTERM
MAX_RETRIES=30
#! /bin/bash
# Copyright 2013 Google Inc. All Rights Reserved.
#
# 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