Skip to content

Instantly share code, notes, and snippets.

# -*- coding: utf-8 -*-
import vobject
import codecs
def main(input, output):
with open(input, 'r') as input_stream:
with codecs.open(output, 'w', encoding='utf-8') as output_stream:
for card in vobject.readComponents(input_stream, False, True, False, False):
try:
@alexnask
alexnask / macd.py
Last active January 19, 2017 12:41 — forked from anesiadis/test2.py
class MACD(Indicator):
def __init__(self, strategy, pair, short_period=12, long_period=26, weight_period=9):
self._weight_period = weight_period
self._weight = 2.0 / (weight_period + 1.0)
self._short_ema = EMA(strategy, pair, period=short_period)
self._long_ema = EMA(strategy, pair, period=long_period)
self._data = pandas.DataFrame(columns=['Value', 'MACD_line', 'Signal_line'])
super(MACD, self).__init__("MACD", strategy, pair)
# coding=utf-8
from __future__ import print_function
import sys
import requests
from bs4 import BeautifulSoup
SEMESTER = 9
sectors = [ u"Επιστήμης και Τεχνολογίας των Κατασκευών", u"Υδραυλικής και Τεχνικής Περιβάλλοντος", u"Γεωτεχνικής Μηχανικής", u"Μεταφορών και Διαχείρισης Έργων" ]
@alexnask
alexnask / test.py
Last active September 15, 2016 16:44
def naturals():
i = 0
while True:
yield i
i += 1
def take(n, f):
i = 0
while i < n:
#ifndef __AUDIO_HPP
#define __AUDIO_HPP
// TODO: Remove this
#include <iostream>
#include <floating_array.hpp>
#include <string>
#include <algorithm>
@alexnask
alexnask / Assembler.d
Last active June 19, 2016 13:03
Work in progress VM in Dlang for my upcoming language's (sky) compile time function evaluation features.
import Opcodes;
import std.getopt;
import std.stdio;
import std.algorithm;
import std.string;
import std.conv;
import std.ascii;
import std.array;
@alexnask
alexnask / test.ooc
Last active December 7, 2015 10:43
Cover template ArrayList implementation
// TODO: write cover template ArrayList
SafeArray: cover template <T> {
data: T*
size: Int
init: func@ ~stealData (=data, =size)
init: func@ (=size) {
data = gc_malloc(size * T size)
@alexnask
alexnask / awesome.lsp
Created August 16, 2015 19:28
AutoLisp script used to complete table info of some specific cross sections based on lines as intelligently as possible
(defun getAllTexts ()
(setq selection (ssget "_X" '((0 . "TEXT,MTEXT")))
textlist (list))
(if selection
(repeat (setq i (sslength selection))
(setq e (ssname selection (setq i (1- i)))
x (cdr (assoc 0 (entget e)))
)
@alexnask
alexnask / publish_packages.sh
Created September 20, 2014 19:57
My little cross-compiling + packaging script for rock (generates builds.ooc-lang.or/packages)
#!/bin/sh
# This script cross-compiles rock for multiple architecures and systems, makes a package for each of them and publishes on builds.ooc-lang.org
# Vendor prefixes should be
# rock/vendor-prefix -> linux64
# rock/win32-vendor-prefix -> win32
# rock/X-vendor-prefix -> X
# $1: architecture to compile to
function compile {
@alexnask
alexnask / macro-test.ooc
Last active August 29, 2015 14:06
Macro ideas
// Rust like system, let's make a simple example macro definition and call
raise-if-null: macro($expr, $msg: Expression) {
if($expr == null) raise($msg)
}
// Call
#raise-if-null(null, "Good!")
// Macros can be expressions or statements