Skip to content

Instantly share code, notes, and snippets.

@mortie
mortie / .vimrc
Last active August 29, 2015 14:08
set nocompatible " be iMproved
filetype off " required!
" Coffeescript
call pathogen#infect()
syntax enable
filetype plugin indent on
" Vundle start
set rtp+=~/.vim/bundle/Vundle.vim
int stringsum(char* str)
{
int sum = 0;
char c;
int i;
for (i = 0; (c = str[i]); ++i)
{
if (c >= 'A' && c <= 'Z')
sum += c - 'A' + 1;
else if (c >= 'a' && c <= 'z')
@mortie
mortie / mandelbrot.c
Last active September 21, 2016 11:13
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <png.h>
#include <pthread.h>
#include <unistd.h>
#include <semaphore.h>
// Modify these
static int xstart = -2;
def color_fn_weighted_random(x):
if x == 0:
x = 101
x = 101 - x
x = min(int((x / 101) * 255), 255)
arr = [
min(randint(int(x // 4), x), 255),
min(randint(int(x // 4), x), 255),
def highlight_line(syntax, theme, line):
ranges = []
# Checks if rng is in any of the existing ranges
# Ranges are tuples, (start, end, color)
def inRange(rng):
for r in ranges:
if rng[0] >= r[0] and rng[1] <= r[1]:
return True
return False
Dec 27 00:52:35 vor bluetoothd[10397]: Failed to set mode: Blocked through rfkill (0x12)
Dec 27 00:52:58 vor bluetoothd[10397]: Unable to get Headset Voice gateway SDP record: Host is down
Dec 27 00:53:10 vor bluetoothd[10397]: a2dp-source profile connect failed for 88:C6:26:D8:B2:9C: Device or resource busy
Dec 27 00:53:10 vor bluetoothd[10397]: /org/bluez/hci0/dev_88_C6_26_D8_B2_9C/fd6: fd(35) ready
Dec 27 01:26:20 vor bluetoothd[10397]: Unable to get io data for Headset Voice gateway: getpeername: Transport endpoint is not connected (107)
Dec 27 10:38:38 vor bluetoothd[10397]: Endpoint unregistered: sender=:1.16 path=/MediaEndpoint/A2DPSource
Dec 27 10:38:38 vor bluetoothd[10397]: Endpoint unregistered: sender=:1.16 path=/MediaEndpoint/A2DPSink
Dec 27 10:38:40 vor bluetoothd[10397]: Failed to obtain handles for "Service Changed" characteristic
Dec 27 10:38:40 vor bluetoothd[10397]: Sap driver initialization failed.
Dec 27 10:38:40 vor bluetoothd[10397]: sap-server: Operation not permitted (1)
import java.util.Arrays;
class Timer implements Comparable<Timer> {
public long time = 0;
private long start = 0;
public Timer start() {
start = System.nanoTime();
return this;
exports.parseStr = parseStr;
class Enum {
constructor(...vals) {
var i = 1;
vals.forEach(j => this[j] = i++);
}
match(val, obj) {
var res = obj[this.str(val)];
#!/bin/sh
py2=$(which python2 2>/dev/null)
py3=$(which python3 2>/dev/null)
py=$(which python 2>/dev/null)
oldcol="\033[31;1m"
newcol="\033[32;1m"
arrowcol="\033[33;1m"
@mortie
mortie / npm-debug.log
Created June 22, 2017 17:53
The npm-debug.log from running `sudo npm install -g dedaemon`
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'install', '-g', 'dedaemon' ]
2 info using npm@5.0.3
3 info using node@v8.1.2
4 verbose npm-session 2a7c2ff34816ea6c
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 https://registry.npmjs.org/dedaemon 26ms (from cache)
8 silly pacote tag manifest for dedaemon@latest fetched in 53ms
9 silly install loadIdealTree