This file contains hidden or 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
#!/bin/sh | |
# | |
# Adds a user to a mac. | |
# | |
# based on this article: http://osxdaily.com/2007/10/29/how-to-add-a-user-from-the-os-x-command-line-works-with-leopard/ | |
# | |
# Usage: ./mac_adduser.sh <username> <uid> <gid> | |
# | |
username=$1 |
This file contains hidden or 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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Webcam test</title> | |
<script type="text/javascript"> | |
function loadstream(stream) { | |
console.log(stream); | |
video = document.getElementById("webcam"); | |
video.src = window.URL.createObjectURL(stream); |
This file contains hidden or 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 python | |
#coding: utf-8 | |
inntekter = { | |
'kontigent': 50.00 * 10 | |
} | |
utgifter = { | |
'domeneavgift': 110, |
This file contains hidden or 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
# -*- encoding: utf-8 -*- | |
# requires a recent enough python with idna support in socket | |
# pyopenssl, cryptography and idna | |
from OpenSSL import SSL | |
from cryptography import x509 | |
from cryptography.x509.oid import NameOID | |
import idna | |
from socket import socket |
This file contains hidden or 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
#!/bin/bash | |
# Copy all ignored files from a git repo to $FOLDER | |
FOLDER= "/path/to/folder" | |
for file in $(git ls-files --others -i --exclude-standard); do | |
cp --parents "$file" "$FOLDER" | |
done |
This file contains hidden or 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
# pyclean command to clear all python cache in a directory | |
# source: https://stackoverflow.com/questions/28991015/python3-project-remove-pycache-folders-and-pyc-files | |
# in .bash_profile / .bash_rc etc put: | |
pyclean () { | |
find . -type f -name '*.py[co]' -delete -o -type d -name __pycache__ -delete | |
} | |
This file contains hidden or 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
# add to .bash_profile / .bashrc / .zshrc | |
function backupgoto { | |
foldername=$(date +%d%m%y) | |
target="${HOME}/gotobackup/${foldername}" | |
mkdir -p "$target" | |
cp -r ${HOME}/.goto "$target" \ | |
&& echo "Backuped goto to $target" \ | |
|| echo "Failed to backup goto" | |
} |
This file contains hidden or 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 sys | |
default = sys.getdefaultencoding() | |
e_in = sys.stdin.encoding | |
e_out = sys.stdout.encoding | |
print(''' | |
python system default encoding: {} | |
stdin: {} | |
stdout: {} | |
'''.format(default, e_in, e_out) |
This file contains hidden or 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
# add this to your bash rc file | |
# It will display the current goto project that is active. | |
# zsh: add this line: | |
# setopt PROMPT_SUBST | |
prompt_goto() { | |
# Check if project command exist | |
if [ -z "$(command -v project)" ]; then | |
return 0 |
This file contains hidden or 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
if DEBUG: | |
EMAIL_HOST = 'localhost' | |
EMAIL_PORT = 1025 | |
EMAIL_HOST_USER = '' | |
EMAIL_HOST_PASSWORD = '' | |
EMAIL_USE_TLS = False | |
DEFAULT_FROM_EMAIL = '[email protected]' |
OlderNewer