Skip to content

Instantly share code, notes, and snippets.

@Fohlen
Fohlen / customFormatter.js
Last active September 25, 2019 09:52
Custom formatter for IGraph
PROPERTY_WHITELIST = [ // decides whether or not consecutive items will be added
'graph',
'nodes',
'edges',
'labels',
'tag',
'text'
]
anonymous = ($class) => $class.isAnonymous || $class.namespace.startsWith('yfiles._R');
@Fohlen
Fohlen / main.cc
Created February 2, 2019 22:14
Thread control
#include <thread>
#include <iostream>
#include <chrono>
#include <future>
void threadFunction(std::shared_future<void> futureObj)
{
std::cout << "Thread Start" << std::endl;
while (futureObj.wait_for(std::chrono::milliseconds(1)) == std::future_status::timeout)
{
@Fohlen
Fohlen / gist:38ae415f13b52d246ccb8a1d4edac607
Created January 28, 2019 17:42 — forked from ttezel/gist:4138642
Natural Language Processing Notes

#A Collection of NLP notes

##N-grams

###Calculating unigram probabilities:

P( wi ) = count ( wi ) ) / count ( total number of words )

In english..

@Fohlen
Fohlen / log
Created December 31, 2018 15:57
conan-grpc issue
package info:
grpc/1.14.1@inexorgame/stable from https://bintray.com/inexorgame/inexor-conan/grpc%3Ainexorgame
system info:
OSX Mojave (10.14.2 (18C54)
c++ -v
Apple LLVM version 10.0.0 (clang-1000.10.44.4)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
@Fohlen
Fohlen / logging.fbs
Last active December 25, 2018 21:46
ok?
namespace Inexorgame.Logging;
include "Inexorgame.Plugin"
/// Describes which level of severity you are logging.
enum LogLevel : byte {
/// Disable all logging. You're on your own now.
Off = 127,
/// This is really fine-grained information—finer even than DEBUG.
Trace,
@Fohlen
Fohlen / server.go
Created December 22, 2018 19:58
Pair with "server"
package main
import (
"fmt"
"os"
"os/signal"
"syscall"
"time"
"nanomsg.org/go/mangos/v2"
@Fohlen
Fohlen / instructions.sh
Created November 29, 2018 18:09
How to set up matplotlib on OSX with Python2.7
# Setting up Matplotlib with python2.7 can be superb pain to set up but a lot of tutorials still use this especially for scikit
# We assume here that you have installed python2.7 via brew (brew install python2.7)
# This means python2.7 is your brew python while python will be your system python
# Configure backend
echo "backend: WXAgg" >> ~/.matplotlib/matplotlibrc
# Go inside your virtualenv with your project and everything
pip install -U wxPython
# After that you will need to exit your VENV
@Fohlen
Fohlen / containerfun.cpp
Last active November 22, 2018 16:30
Container fun
#include <algorithm>
#include <list>
#include <string>
#include <iostream>
using namespace std;
template <typename T>
void print_list(list<T> l) {
for (auto e: l)
{
@Fohlen
Fohlen / rules
Created October 13, 2018 09:04
Docker+ufw
# Put in /etc/ufw/after.rules
# Put Docker behind UFW
*filter
:DOCKER-USER - [0:0]
:ufw-user-input - [0:0]
-A DOCKER-USER -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
-A DOCKER-USER -m conntrack --ctstate INVALID -j DROP
-A DOCKER-USER -i eth0 -j ufw-user-input
@Fohlen
Fohlen / dns
Created September 25, 2018 15:30
uberspace_inexor
$TTL 86400
@ IN SOA ns1.first-ns.de. postmaster.robot.first-ns.de. (
2018082301 ; serial
14400 ; refresh
1800 ; retry
604800 ; expire
86400 ) ; minimum
@ IN NS ns1.first-ns.de.
@ IN NS robotns2.second-ns.de.