Skip to content

Instantly share code, notes, and snippets.

View Loknar's full-sized avatar

Sveinn Flóki Guðmundsson Loknar

  • Iceland
View GitHub Profile
@Loknar
Loknar / untrusted-lvl13-solution.js
Created April 9, 2014 03:52
untrusted-lvl13-solution.js
/*
* robotMaze.js
*
* The blue key is inside a labyrinth, and extracting
* it will not be easy.
*
* It's a good thing that you're a AI expert, or
* we would have to leave empty-handed.
*/
@Loknar
Loknar / Default (Linux).sublime-keymap
Last active December 16, 2016 21:43
Sublime Text 3, missing accented characters fix for ubuntu 14.10.
[
// missing accented characters fix for ubuntu 14.10
// a, [á, å, ä]
{ "keys": ["´","a"], "command": "insert", "args": {"characters": "á"}},
{ "keys": ["°","a"], "command": "insert", "args": {"characters": "å"}},
{ "keys": ["¨","a"], "command": "insert", "args": {"characters": "ä"}},
// A, [Á, Å, Ä]
{ "keys": ["´","A"], "command": "insert", "args": {"characters": "Á"}},
youtube-dl-mp3()
{
youtube-dl --extract-audio --audio-format mp3 --output "~/Music/youtube-downloads/%(title)s.(ext)s" $1
}
#!/usr/bin/python
# -*- coding: utf-8 -*-
import sys
import traceback
from fabric.api import task, env, run, settings
from fabric.utils import abort
from fabric.colors import blue, green, yellow, red
from my_slackclient import slack_msg
#!/usr/bin/python
# -*- coding: utf-8 -*-
from slackclient import SlackClient
CHANNEL_ID = 'add_channel_id_here'
SLACKBOT_TOKEN = 'add_slackbot_token_here'
def slack_msg(msg, channel=CHANNEL_ID):
token = SLACKBOT_TOKEN
sc = SlackClient(token)
<?php
/*
function flettitakkar($num_of_things, $page, $slod, $max_per_page = 30)
Skilar flettitökkum í streng sem html kóða.
$num_of_things er fjöldi hluta
$page er númer síðunnar sem verið er að birta (0,1,2,3 ...)
Viljum sækja GET gildið page með php kóða en ef það klikkar þá látum við page gildið vera 0, dæmi:
if(filter_has_var(INPUT_GET, "page") !== false && filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT) !== false) {
$page = filter_input(INPUT_GET, "page", FILTER_SANITIZE_NUMBER_INT);
/**
* A simple script for easily serving a folder containing static website.
* It's shamelessly snatched from https://gist.github.com/ryanflorence/701407
* and might be vurnerable to directory traversal attack, yet I've not been
* able to make such an attack work.
*
* TODO: maybe fix ugly repetitiveness?
**/
var http = require("http"),
url = require("url"),
var localStorageWorks = function(debug) {
// simple test function to see if window.localStorage works
try {
window.localStorage.setItem("Test", "localStorageWorks");
if (window.localStorage.getItem("Test") !== "localStorageWorks") {
throw new Error("localStorage seems to be broken");
}
if (debug) {
console.log("localStorageWorks: returned positive")
}

Signal

Disclaimer: The following are glossaries I've written to simplify sharing what the Signal application is all about with friends or others. I am not associated with Signal and/or Open Whisper Systems in any way.

Signal App Icon

Signal is a free and open source software application for Android, iOS, and Desktop that employs end-to-end encryption (E2EE), allowing users to send end-to-end encrypted group, text, picture, video messages or other attachments, and have encrypted phone conversations between Signal users. Although Signal uses telephone numbers as contacts, encrypted calls and messages use your data connection so both parties to the conversation must have internet access on their mobile devices.

@Loknar
Loknar / Oskhyggja.md
Last active January 13, 2019 14:41
Íslenskur texti fyrir snoturt lag úr japanskri teiknimyndaseríu.