This file contains 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 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 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 | |
# | |
# cocoa_keypress_monitor.py | |
# Copyright © 2016 Bjarte Johansen <Bjarte.Johansen@gmail.com> | |
# | |
# The MIT License (MIT) | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining | |
# a copy of this software and associated documentation files (the | |
# “Software”), to deal in the Software without restriction, including |
This file contains 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): |
OlderNewer