This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="module"> | |
import $ from './dollar.js'; | |
$('a').on('click', (e) => { | |
e.preventDefault(); | |
console.log(e.currentTarget); | |
alert('ello'); | |
}); | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in *; do | |
if [[ ! -d "$i" ]]; then continue; fi; | |
from=$i | |
to=$(echo "$i" \ | |
| tr -cd '\11\12\15\40-\176' \ | |
| sed -e 's/^[[:space:]]*//' \ | |
| sed 's/ /-/g') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import logging | |
from django.conf import settings | |
from django.contrib.auth.models import User | |
import ldap3 | |
from ldap3.core import exceptions | |
logger = logging.getLogger(__name__) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# wrapper around docker-compose that remembers the file argument | |
set -euo pipefail | |
cmd_arg=${1:-} | |
state_file=~/.docofile | |
get_compose_file () { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage example: | |
# get_hashed_file "https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm" "c070b754ce2de9f714ab4db4736c7e05" | |
get_hashed_file() { | |
local url=$1 | |
local filename=${url##*/} | |
local hash=$2 | |
if [[ ! -f "$filename" ]]; then | |
echo "downloading $url" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
set nocompatible " be iMproved, required | |
filetype off " required | |
" set the runtime path to include Vundle and initialize | |
set rtp+=~/.vim/bundle/Vundle.vim | |
call vundle#begin() | |
" alternatively, pass a path where Vundle should install plugins | |
"call vundle#begin('~/some/path/here') | |
" let Vundle manage Vundle, required |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[user] | |
name = Anton Agestam | |
email = git@antonagestam.se | |
[core] | |
editor = vim | |
excludesfile = ~/.gitignore | |
[rerere] | |
enabled = 1 | |
[color] | |
diff = auto |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import namedtuple | |
from aiomysql.cursors import Cursor, SSCursor | |
class _NamedTupleCursorMixin: | |
async def _do_get_result(self): | |
await super()._do_get_result() | |
fields = [] | |
if self._description: | |
for f in self._result.fields: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
get_lock () { | |
# get_lock assures only one process of a kind can be active at a time. It | |
# takes a path to a lockfile as its first argument and the number of seconds | |
# to let processes run for as its second argument. Use release_lock to | |
# remove the lockfile. | |
# | |
# To get an infinite lock, pass "infinite" as the locktime argument. This | |
# makes processes trying to acquire locks exit immediately if one already | |
# exists. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# The logging functions all take input both as arguments and as stdin so that | |
# logging can be piped from other commands. The commands use this themselves: | |
# `log_sub` pipes into `log` which pipes into `prefix`. | |
prefix () { | |
local replace="s/^/$1/" | |
if (( $# > 1 )); then |