Skip to content

Instantly share code, notes, and snippets.

View Tehnix's full-sized avatar
🌞
Enjoying the code...

Christian Kjær Tehnix

🌞
Enjoying the code...
View GitHub Profile
@Tehnix
Tehnix / sVimrc
Last active August 29, 2015 14:22
Safari VIM configuration - https://github.com/flipxfx/sVim
" Settings
let hintcharacters = "qwertyuiopasdfgzxcvbnm";
let homeurl = "blank://";
let mapleader = ","
let newtaburl = "blank://"
let blacklists = ["*://facebook.com/messages/*", "*://mail.google.com/*"]
" Shortcuts
"unmapAll
map "j" scrollDown
@Tehnix
Tehnix / Cryptologi Notes.md
Created May 27, 2015 07:10
Cryptologi Notes

General

  • Prime Number
  • A prime number is a positive ingeger not divisible (without a remainder) by any positive integer other than itself and 1.
  • A positive integer can be written uniquely (up to reordering) as a product of prime numbers.
  • Example
    • 60 = 2 x 2 x 3 x 5 = 2^2 x 3 x 5.
  • Coprime
  • Two integers a and b are said to be coprime if the only positive integer that evenly divides both of them is 1. That is, the only common positive factor of the two numbers is 1.
  • For example, gcd(14,15) = 1 are coprime but gcd(14,21) = 7 are not coprime.
@Tehnix
Tehnix / PVR TODO.md
Last active August 29, 2015 14:15
Things involved in a PVR for TV-Shows and Animes

This a list of things that a PTR should, at least, include. A first approach could use some sensible defaults, like targeting XBMC and Transmission, having a set priority of episode download qualities etc.

Web interface

  • Nice UI
  • Username/Password
  • Date/time
    • Use same time the server uses
    • Use the format: Thu, 31/12/2015

Download new episodes

@Tehnix
Tehnix / receiver.py
Last active March 9, 2018 19:45
Streamer and receiver. The streamer broadcasts your webcam video via multicast, and the receiver displays the stream.
#!/usr/bin/env python2.7
import socket
import struct
import cv2
import numpy
MCAST_GRP = '224.0.0.1'
MCAST_PORT = 5007
@Tehnix
Tehnix / brew-up-system.sh
Last active December 7, 2023 18:55
Set up OS X with brew
#!/bin/sh
binaries=(
awscli
trash
tree
git
mosh
tmux
screen
zsh
#!/bin/sh
COMPUTER_NAME="tehnix"
# Some things taken from here
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
# Set the colours you can use
black='\033[0;30m'
white='\033[0;37m'
@Tehnix
Tehnix / irssi_pushover.sh
Created September 24, 2014 18:39
Send http://pushover.net notifications via their API to your devices, whenever someone highlights you on irssi.
#!/bin/bash
# Replace `YOUR_APP_TOKEN` and `YOUR_USER_TOKEN` with your values from pushover
tail -f /home/user/.irssi/fnotify | while read heading message; do
url=`echo "${message}" | grep -Eo 'https?://[^ >]+' | head -1`;
if [ ! "$url" ]; then
curl -s \
--form-string "token=YOUR_APP_TOKEN" \
--form-string "user=YOUR_USER_TOKEN" \
--form-string "message=${message}" \
@Tehnix
Tehnix / irssi_notifier.sh
Created September 23, 2014 12:40
Native notifications for irssi. Requires terminal-notifier, autossh and that you got the fnotify plugin running in irssi on your server. Replace both instances of user@server with your details (note it also assumes private keys are set up).
#!/opt/local/bin/zsh
irssi_notifier() {
(ssh user@server -o PermitLocalCommand=no \
": > .irssi/fnotify ; tail -f .irssi/fnotify " | \
while read heading message; do \
url=`echo "${message}" | grep -Eo 'https?://[^ >]+' | head -1`; \
if [ ! "$url" ]; then terminal-notifier -sender com.apple.Terminal -message "${message}" -title "${heading}" -activate com.apple.Terminal; \
else terminal-notifier -sender com.apple.Terminal -message "${message}" -title "${heading}" -open "${url}"; \
fi; \
done)
@Tehnix
Tehnix / .vimrc
Created September 20, 2014 21:18
Vim Configuration File
" ========== Vim Plug Settings ============="
let IWantPlug=1
let VimPlugDir=expand('~/.vim/autoload/plug.vim')
if !filereadable(VimPlugDir)
echo "Installing vim-plug.."
echo ""
silent !mkdir -p ~/.vim/autoload
silent !mkdir -p ~/.vim/bundle
silent !curl -fLo ~/.vim/autoload/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
@Tehnix
Tehnix / .vimrc
Created September 13, 2014 18:20
Plugin Section Of Vim Configuration File
" ========== Vim Plug Settings ============="
let IWantPlug=1
let VimPlugDir=expand('~/.vim/autoload/plug.vim')
if !filereadable(VimPlugDir)
echo "Installing vim-plug.."
echo ""
silent !mkdir -p ~/.vim/autoload
silent !mkdir -p ~/.vim/bundle
silent !curl -fLo ~/.vim/autoload/plug.vim https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim