Skip to content

Instantly share code, notes, and snippets.

View falgon's full-sized avatar
💭
I may be slow to respond.

Roki falgon

💭
I may be slow to respond.
View GitHub Profile
@falgon
falgon / bayes_venn.py
Last active July 26, 2018 06:19
Visualization of the probability of events
import matplotlib
matplotlib.use('AGG')
from collections import Counter
from matplotlib import pyplot as plt
from matplotlib import patches as mpatches
from matplotlib.lines import Line2D
from matplotlib_venn import venn2
@falgon
falgon / Makefile
Last active July 20, 2018 23:42
Connecting mysql
# Dependencies
# - Connector/C++: https://dev.mysql.com/downloads/connector/cpp/8.0.html
# - Boost C++ Libraries 1.67.0: https://sourceforge.net/projects/boost/files/boost/1.67.0/
# - Srook C++ Libraries: https://github.com/falgon/SrookCppLibraries
CXX:=clang++ -stdlib=libc++
CXXFLAGS:=-std=c++11
CPPFLAGS:=-Wall -Wextra -pedantic -I/usr/local/include/ -I./ `pkg-config mysqlclient --cflags --libs`
LDFLAGS:=-L/usr/local/opt/mysql-client/lib
LDLIBS:=-lmysqlcppconn
@falgon
falgon / Visdislog.py
Created July 2, 2018 07:52
Visualization of discrete logarithms
# -*- coding:utf-8 -*-
import matplotlib
matplotlib.use('AGG')
import numpy as np
import sympy as sym
import matplotlib.pyplot as plt
import seaborn as sns
@falgon
falgon / de_bruijn_seq.py
Created June 22, 2018 07:29
Generate graph the B(2, 3)
import networkx as nx
import pylab as plt
import pygraphviz as pgv
from networkx.drawing.nx_agraph import graphviz_layout, to_agraph
def de_bruijn_graph(st, k):
edges = []
nodes = set()
for i in range(len(st) - k + 1):
edges.append((st[i : i + k - 1], st[i + 1 : i + k]))
@falgon
falgon / EquivalentBinaryTrees.go
Created June 17, 2018 10:07
My solutions of A Tour of Go and other practice golang codes
package main
import (
"fmt"
"sort"
"golang.org/x/tour/tree"
)
func Walk(t *tree.Tree, ch chan int) {
defer close(ch)
# -*- coding:utf-8 -*-
#!/usr/bin/env python
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import warnings
from matplotlib.font_manager import FontProperties
@falgon
falgon / LICENSE.txt
Last active July 16, 2017 14:10
Simply network play type Shogi
GNU LESSER GENERAL PUBLIC LICENSE
Version 3, 29 June 2007
Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
This version of the GNU Lesser General Public License incorporates
the terms and conditions of version 3 of the GNU General Public
MIT License
Copyright (c) 2017 roki
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
furnished to do so, subject to the following conditions:
@falgon
falgon / fizzbuzz.cpp
Created February 28, 2012 19:14
コンパイル時FizzBuzz
#define BOOST_MPL_LIMIT_STRING_SIZE 128
#include<iostream>
#include<boost/mpl/string.hpp>
#include<boost/mpl/fold.hpp>
#include<boost/mpl/size_t.hpp>
#include<boost/type_traits.hpp>
#include<boost/type_traits/conditional.hpp>
namespace mpl=boost::mpl;
@falgon
falgon / kerio.hpp
Created January 11, 2012 11:25
迷路解析
// kerio.hpp
#include<vector>
#include<queue>
#include<iostream>
#include<fstream>
#define pY(x){dy.push_back(x);}
#define pX(xx){dx.push_back(xx);}
class Keiro{