Skip to content

Instantly share code, notes, and snippets.

View nsmaciej's full-sized avatar
🙂
o awen pona

Maciej Goszczycki nsmaciej

🙂
o awen pona
View GitHub Profile
@nsmaciej
nsmaciej / s1.c
Created February 23, 2014 15:33
All my solutions
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#define each(_a, _b) for (_a = 0; _a < _b; ++_a)
bool dow(int a, int b, int c, int x) {
return 0 == a*(x*x) + b*x + c;
}
@nsmaciej
nsmaciej / sweet.js
Created February 27, 2014 23:53
Messing around with sweet.js (sweetjs.org)
macro $ttos {
case {_ $x} => {
var pattern = #{$x};
var tokenString = pattern[0].token.value.toString();
var stringValue = makeValue(tokenString, #{$here});
return withSyntax($val = [stringValue]) {
return #{$val};
}
}
}
@nsmaciej
nsmaciej / textdecompression.py
Created April 24, 2014 23:55
Text Decompression - Call To Code - The golfed solution
import re;t=input();m=1
while m:
m=re.search('\((\d+)(\w+)\)',t)
if m:t=t[:m.start()]+int(m.group(1))*m.group(2)+t[m.end():]
print(t)
@nsmaciej
nsmaciej / Main.hs
Created July 27, 2014 16:55
Eurosong game predictor - See http://games.usvsth3m.com/eurosong/
module Main where
import Control.Applicative ((<$>))
import Control.Monad (replicateM)
import Text.Read (readMaybe)
import Data.Maybe (fromJust)
import System.IO (hFlush, stdout)
import Text.Printf (printf)
import Data.List (genericLength)
@nsmaciej
nsmaciej / london-underground.py
Last active August 29, 2015 14:04
A simple python web server for returning live data from the London Underground. Example request: /B/BST/1
'''
The MIT License (MIT)
Copyright (c) 2014 Maciej Goszczycki
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 without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@nsmaciej
nsmaciej / toggler.scpt
Created August 24, 2014 11:10
Repeatedly toggle Skype status using AppleScript
# Not using "offline" beacuse of the wait..
set allowed_statuses to {"online", "dnd", "invisible", "away"}
set delay_time to 0.5
repeat
repeat with status in allowed_statuses
delay delay_time
log "Chaning status to " & status
tell application "Skype"
send command "SET USERSTATUS " & status script name "Toggler"
@nsmaciej
nsmaciej / inti.el
Last active August 29, 2015 14:05
My broken emacs config
;; init.el - Maciej's Emacs config
;; Copyright (C) 2014 Maciej Goszczycki
;; This program is free software; you can redistribute it and/or
;; modify it under the terms of the GNU General Public License
;; as published by the Free Software Foundation; either version 2
;; of the License, or (at your option) any later version.
;; This program is distributed in the hope that it will be useful,
;; but WITHOUT ANY WARRANTY; without even the implied warranty of
@nsmaciej
nsmaciej / skype.scpt
Created August 31, 2014 16:58
Emoticon formatter v1
# Setup variables - chnage this to whatevery you want
set emoticon_shape to "
* * * ***
* * **
*** * **
* * *
* * * *"
set emoticon_char to "(bow)"
set match_length to 3
set message_target to "username"
@nsmaciej
nsmaciej / usaco-mode.el
Last active August 29, 2015 14:07
usaco-mode.el
;;; usaco-mode.el - Mode for quickly testing USACO solutions
;; Copyright (C) 2014 Maciej Goszczycki
;; Author: Maciej Goszczycki <[email protected]>
;; Created: 9 October 2014
;; Version: 0.0.0
;; Keywords: compile run convenience
;;; Commentary:
@nsmaciej
nsmaciej / README.md
Last active August 29, 2015 14:10
PDP-8 Simple program V1

Scrolling MQ

A simple program for PDP-8/e. It should work on other PDP-8s, but the Extended Arthmetic Element is required as it uses the MQ register. It creates a scrolling effect on the MQ (Multiplier Quotient) by left shfiting it, after a given time.

How to run

  • Set switches to 0000 and press LOAD ADDR
  • Toggle in the 2nd column of the below "binary", pressing DEP (Deposit) after each one
  • Set switches to 0002 and press LOAD ADDR