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
| p ← •BQN ¨ •file.Lines ⊑ •args | |
| T1 ← +´1↓»⊸< | |
| T2 ← +´˘3↕⊢ | |
| •Show T1 p | |
| •Show T1∘T2 p |
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
| % The first task is to find numbers in a list that sum up to 2020. We | |
| % will solve this problem using constraint logic programming over | |
| % finite domains in prolog. | |
| :- use_module(library(clpfd)). | |
| :- use_module(library(dcg/basics)). | |
| % In the first part we are given a list of numbers and we want to find | |
| % 2 numbers that sum up to the value 2020 and then calculate the | |
| % product of those two numbers. We therefore want a predicate that | |
| % takes the length of the list of numbers to find (Length), and will |
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
| * Introduction to NLP for Norwegian text | |
| Norwegian is slightly strange | |
| - Two written forms | |
| - Idiosyncratic capitalization rules | |
| - Normativish grammar | |
| - Semantically driven | |
| Recommended tools | |
| - UDPipe: http://ufal.mff.cuni.cz/udpipe |
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 | |
| # Slack notification script for Munin | |
| # Mark Matienzo (@anarchivist) | |
| # | |
| # To use: | |
| # 1) Create a new incoming webhook for Slack | |
| # 2) Edit the configuration variables that start with "SLACK_" below | |
| # 3) Add the following to your munin configuration: | |
| # |
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 -eu | |
| LOG_FILE=$1 | |
| SB="stdbuf -i0 -oL" | |
| shift | |
| tput sc | |
| $@ 2>&1 | $SB tee $LOG_FILE | $SB cut -c-$(tput cols) | $SB sed -u 's/\(.\)/\\\1/g' | $SB xargs -0 -d'\n' -iyosi -n1 bash -c 'tput rc;tput el; printf "\r%s" yosi' | |
| EXIT_CODE=${PIPESTATUS[0]} | |
| tput rc;tput el;printf "\r" # Delete the last printed line | |
| exit $EXIT_CODE |
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 bash | |
| input_file="${1:-/dev/stdin}" | |
| sed '/^\s*$/d' "$input_file" \ | |
| | paste -d '\t\0' - - - \ | |
| | sed -e 's/\([^"]*\)$/\t\1/' \ | |
| -e 's,<word>\(.*\)</word>,\1,' \ | |
| -e 's/"<\(.*\)>"\t"\(.*\)"/\1\t\2/' \ | |
| | cut -f3 \ | |
| | sed 's/./\L\0/g' |
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 python3 | |
| import codecs | |
| import csv | |
| import re | |
| import sys | |
| import time | |
| def parse_date(s): | |
| # We assume that the date is always in the format '10.01.2014'. |
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
| from os import listdir | |
| from os.path import join | |
| from re import match, findall, search, M | |
| from time import mktime, strptime | |
| from tldextract import extract | |
| from collections import defaultdict | |
| from HTMLParser import HTMLParser | |
| class FindAllAs(HTMLParser): | |
| def __init__(self, siteURL): |
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/python2.6 | |
| # I COULD ONLY GET IT TO RUN IN PYTHON2.6 | |
| # Running it in python2.7, installed from homebrew results in a segfault. | |
| # I haven't been able to investigate why. | |
| # Code translated from http://osxbook.com/book/bonus/chapter2/alterkeys/ | |
| # License: http://ljos.mit-license.org/ | |
| from Quartz import ( | |
| CGEventGetIntegerValueField, CGEventSetIntegerValueField, | |
| kCGKeyboardEventKeycode, | |
| kCGEventKeyDown, kCGEventKeyUp, |
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
| # Copyright @ Bjarte Johansen 2012 | |
| # License: http://ljos.mit-license.org/ | |
| from AppKit import NSApplication, NSApp, NSWorkspace | |
| from Foundation import NSObject, NSLog | |
| from PyObjCTools import AppHelper | |
| from Quartz import kCGWindowListOptionOnScreenOnly, kCGNullWindowID, CGWindowListCopyWindowInfo | |
| class AppDelegate(NSObject): | |
| def applicationDidFinishLaunching_(self, notification): |
NewerOlder