Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
I may be slow to respond.

Roki falgon

💭
I may be slow to respond.
View GitHub Profile
@falgon
falgon / radiko_2020.sh
Created Nov 28, 2020 — forked from FREEWING-JP/radiko_2020.sh
radikoをlinuxで聞いたり録音したりするやつ 2020年対応版
View radiko_2020.sh
#!/bin/bash
# https://mtunn.wordpress.com/odroid-u2★セットアップ/radikoの録音・再生(archlinux)/
pid=$$
wkdir='/var/tmp'
playerurl=https://radiko.jp/apps/js/flash/myplayer-release.swf
playerfile="${wkdir}/player.swf"
keyfile="${wkdir}/authkey.png"
auth1_fms="${wkdir}/auth1_fms_${pid}"
auth2_fms="${wkdir}/auth2_fms_${pid}"
@falgon
falgon / porting.sh
Created Aug 9, 2020
Simple script to migrate from my old blog to new blog
View porting.sh
#!/bin/bash
function fix_metadata() {
i="$1"
fname="$2"
line="$3"
if [ "`echo "$line" | grep 'Title'`" ]; then
sed -i -e "${i}s/Title/title/g" "$fname"
elif [ "`echo "$line" | grep 'Tags'`" ]; then
@falgon
falgon / addtag.sh
Last active Jun 14, 2020
TagSpaces (https://www.tagspaces.org/) を使うに当たって CLI 上でタグを付与 (ファイル名を変更) するユーティリティツール
View addtag.sh
#!/bin/bash
json_name="" # set exported tagspaces json file path
help_message() {
echo "Usage:"
echo -e "\taddtag ([option] [filename | tag_title] | [filename] tagname...)"
echo -e "\toption:"
echo -e "\t\t-rm:\tremoving tags from [filename]"
echo -e "\t\t-show:\tshow specified tag"
@falgon
falgon / asm_dsl_eg_impl.cpp
Last active Jan 17, 2020
Example implementation of monadic assembly language DSL using C++17 and etc (One of my graduation studies)
View asm_dsl_eg_impl.cpp
#include <boost/preprocessor/seq/for_each.hpp>
#include <boost/preprocessor/variadic/to_seq.hpp>
#include <functional>
#include <iostream>
#include <iterator>
#include <sstream>
#include <tuple>
#include <type_traits>
namespace dhu_grad {
@falgon
falgon / live_preview.py
Last active Jul 5, 2019
My blog live reviewer
View live_preview.py
#!/usr/bin/env python3
from livereload import Server, shell
from sys import argv
class live_view:
def __init__(self):
self.sv = Server()
self.is_run = False
def __enter__(self):
@falgon
falgon / LinearEquationsPlot2.hs
Last active Oct 24, 2018
Linear equations method.
View LinearEquationsPlot2.hs
module Main where
import Control.Monad.Fix (fix)
import Data.Bool (bool)
import Data.Tuple.Extra (first, second, dupe, (***))
import Data.Maybe (maybe)
import Graphics.Rendering.Chart.Backend.Cairo
import Graphics.Rendering.Chart.Easy
import System.IO (IOMode (..), withFile, hGetLine, hIsEOF)
import System.Exit (exitFailure)
@falgon
falgon / cube_and_section.py
Last active Sep 29, 2018
The figure of cube and its section
View cube_and_section.py
from matplotlib import use
use('AGG')
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.patches import Rectangle
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d.art3d import Poly3DCollection, Line3DCollection
class cube_fig:
def __init__(self, fname, rectangle):
View simple_norm.py
import scipy.stats.distributions as dis
import numpy as np
import pylab as pl
from matplotlib import pyplot as plt
def main():
plt.rc('text', aa=True, usetex=True)
x = np.arange(-5, 5, 0.1)
for i in range(1, 6):
@falgon
falgon / montyhall.py
Created Jul 27, 2018
Visualization of monty hall problem
View montyhall.py
from random import randrange
from matplotlib import use
use('AGG')
from matplotlib import pyplot as plt
class MontyHallproblem:
def __init__(self, fname, tryN):
self.fname = fname
@falgon
falgon / bayes_venn.py
Last active Jul 26, 2018
Visualization of the probability of events
View bayes_venn.py
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