Skip to content

Instantly share code, notes, and snippets.

View N-Coder's full-sized avatar

Niko Fink N-Coder

  • TU Wien
  • Vienna
  • 08:31 (UTC +02:00)
View GitHub Profile
import matplotlib.pyplot as plt
import numpy as np
plt.xkcd()
fig = plt.figure()
ax = fig.add_axes((0.1, 0.25, 0.8, 0.7))
t = np.arange(0.0, 2.4 * np.pi, 0.1)
ax.plot(t, (np.power(np.sin(t), 2) * (1 + t / 1.5 / np.pi)) + 1, 'b-')
@N-Coder
N-Coder / studip-api-fetch.py
Created November 9, 2017 13:58
Fetch all available data through the python Stud.IP API client
import asyncio
import logging
import os
import warnings
from asyncio.futures import _chain_future as chain_future
import attr
from studip_api.session import StudIPSession
@N-Coder
N-Coder / studip-overlay.sh
Last active November 20, 2017 15:47
Overlay writable overlayFS on top of read-only Stud.IP FUSE
#!/bin/bash
# Allow root access to FUSE devices mounted with -o allow_root option
# see https://blog.oxplot.com/allow-root-access-fuse-mount/
echo "user_allow_other" >> /etc/fuse.conf
cd ~user/studip
# Start studip-fuse in background and mount at ~user/studip/lower
studip-fuse --user user12 --format "{semester-lexical}/{course}/{type}/{short-path}/{name}" --mount ./lower --allowroot &
@N-Coder
N-Coder / call_soon_threadsafe_loop_stop.log
Created January 31, 2018 16:48
Python 3.5 asyncio loop.stop threading problem
2018-01-31 17:45:06,829 MainThread - root I - Starting loop thread
2018-01-31 17:45:06,829 run_loop - asyncio D - Using selector: EpollSelector
2018-01-31 17:45:06,830 MainThread - root I - Started loop thread
2018-01-31 17:45:06,830 run_loop - root I - running loop
2018-01-31 17:45:07,831 MainThread - root I - Scheduling something in the far future
2018-01-31 17:45:07,831 run_loop - asyncio I - poll took 1001.507 ms: 1 events
2018-01-31 17:45:07,832 run_loop - root I - schedule_later: far future
2018-01-31 17:45:08,832 MainThread - root I - Scheduling something in the near future
2018-01-31 17:45:08,833 run_loop - asyncio I - poll 29999.713 ms took 1000.840 ms: 1 events
2018-01-31 17:45:08,833 run_loop - root I - schedule_later: near future
@N-Coder
N-Coder / Notizen.tex
Created February 4, 2018 15:52
TaPL Notizen
\documentclass[a4paper,10pt]{article}
% IMPORTS
\usepackage{amsfonts}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{graphicx}
\usepackage{titlesec}
\usepackage{wrapfig}
\usepackage[ngerman]{babel}
blockdiag {
orientation = portrait;
begin[shape=beginpoint, description="on_request_start"];
redirect[description="on_request_redirect"];
end[shape=endpoint, description="on_request_end"];
exception[shape=flowchart.terminator, description="on_request_exception"];
//acquire_connection[description="Connection acquiring"];
@N-Coder
N-Coder / dsl-twitter-crawler-sketch.py
Created May 3, 2018 16:40
Twitter crawler to obtain information on hashtag users and their network for the Data Science Lab
from pprint import pprint
import twitter
api = twitter.Api(consumer_key="",
consumer_secret="",
access_token_key="",
access_token_secret="")
pprint(api.VerifyCredentials())
@N-Coder
N-Coder / mongodb-array-not-empty.log
Last active May 15, 2018 06:55
MongoDB indexed array { $gt: -Infinity } vs { $exists: true, $ne: [] }}
> db.users.find({'seen_events': { $gt: -Infinity }}).explain('executionStats')
{
"queryPlanner" : {
"plannerVersion" : 1,
"namespace" : "dsl_tweet_database.users",
"indexFilterSet" : false,
"parsedQuery" : {
"seen_events" : {
"$gt" : -Infinity
}

Keybase proof

I hereby claim:

  • I am n-coder on github.
  • I am ncode (https://keybase.io/ncode) on keybase.
  • I have a public key whose fingerprint is 0328 65A8 D11F 7600 3483 CB0D D0D4 1DD0 BD7C 18C0

To claim this, I am signing this object:

@N-Coder
N-Coder / output.log
Created June 12, 2019 19:19
ics.py make_all_day duration oddity
start end duration all-day event all-day duration
------------------------- ------------------------- ---------- ----------------------------------------------- ------------------
2019-05-28T21:00:00-03:00 2019-05-28T21:00:00-03:00 0 <all-day Event 2019-05-28> 24
2019-05-28T21:00:00-03:00 2019-05-28T22:00:00-03:00 1 <all-day Event 2019-05-28> 24
2019-05-28T21:00:00-03:00 2019-05-28T23:00:00-03:00 2 <all-day Event 2019-05-28> 24
2019-05-28T21:00:00-03:00 2019-05-29T00:00:00-03:00 3 <all-day Event begin:2019-05-28 end:2019-05-30> 48
2019-05-28T21:00:00-03:00 2019-05-29T01:00:00-03:00 4 <all-day Event begin:2019-05-28 end:2019-05-30> 48
2019-05-28T21:00:00-03:00 2019-05-29T17:00:00-03:00 20 <all-day Event begin