Skip to content

Instantly share code, notes, and snippets.

@o314
o314 / multidispatch-friendly_zen_of_unzip_in_julia.md
Last active January 28, 2022 09:55
Multidispatch-friendly zen of unzip in julia

Multidispatch-friendly zen of unzip in julia

@ https://gist.github.com/o314/214e26c6fb70512b56597d633dd87e6f
see JuliaLang/julia#13942

OK unzip(a) = zip(a...) fails in Julia But Zen of python is great - ok, it's somewhat a lie, it's also great for julia ! So let's try to bring correct simple things first, and (maybe) complicated ones later or away.

FWIW, my good-enough-poor-man, but usable in prod, isn't it, unzip considering than

@o314
o314 / TvShowNfo.kt
Created January 17, 2022 22:51 — forked from soywiz/TvShowNfo.kt
VideoStation's VsMeta File Format (released as PUBLIC DOMAIN) https://unlicense.org/
package com.soywiz.util
import com.soywiz.klock.*
import com.soywiz.korio.file.*
import com.soywiz.korio.serialization.xml.*
class TvShowNfo {
data class Info(
var title: String = "",
var sortTitle: String? = null,
@o314
o314 / export_vsmeta_to_xml.sql
Created December 23, 2021 02:39 — forked from tohuuuuu/export_vsmeta_to_xml.sql
Export result of SQL Query to XML - Synology VideoStation metadata
CREATE TEMP TABLE "videodata_tmp" AS
SELECT
v.mapper_id as id,
'home'||v.mapper_id as uniqueid,
right(v.path, position('/' in reverse(v.path)) - 1) as filename,
v.path,
g2.genre,
h.title,
h.record_time,
s.summary
## Some graph functions ##
using Iterators
using Combinatorics
using Base.LinAlg: checksquare
#=
X = sparse([1,1,2,2,3,4,4], [2,5,5,3,4,5,6], 1, 6, 6)
X += X'
G = dropzeros!(1 - X)
@o314
o314 / main.jl
Created February 10, 2021 12:05
last_kata.jl
#= -----------------------------------------------------------------------------
GREED (DICE GAME) KATA
--------------------------------------------------------------------------------
Write a class Greed with a score() method that accepts an array of die values
(up to 6). Scoring rules are as follows:
A single one (100)
A single five (50)
Triple ones [1,1,1] (1000)
@o314
o314 / juliacontribmontage.jl
Created October 14, 2020 05:55 — forked from jiahao/juliacontribmontage.jl
Creates a photo montage of Julia contributors using ImageMagick
#Working version
using JSON
auth_token= #fill in to access Github API
function getcontribs(owner, repo, auth_token)
#Download information about contributors
page, authors=0, {}
while true #Download every page
page += 1
url="https://api.github.com/repos/$owner/$repo/contributors?page=$(page)&access_token=$(auth_token)"
@o314
o314 / File1.bash
Created April 8, 2020 17:31
conf-unity-icons
# for unity gui
DST_BASE="/usr/share/icons/Humanity/mimes"
for mime in *; do
[ -e "$mime" ] || continue
[ -d "$mime" ] || continue
echo "conf mime-type ${mime}"
for size in ${mime}/*.svg; do
@o314
o314 / readme.md
Created April 8, 2020 17:30
Diagram of how-i-would-like-to-write-golang
@o314
o314 / clean_code.md
Created August 23, 2019 02:29 — forked from wojteklu/clean_code.md
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@o314
o314 / stdlib-deps-dot.jl
Created December 6, 2018 16:04 — forked from rschwarz/stdlib-deps-dot.jl
Write dependencies in Julia's stdlib using DOT format
import Pkg
import Pkg.TOML
const STDLIB_DIR = "/home/rs/opt/julia-1.0.2/share/julia/stdlib/v1.0"
const STDLIBS = readdir(STDLIB_DIR)
println("digraph stdlib {")
for (i, stdlib) in enumerate(STDLIBS)
proj = Pkg.TOML.parsefile(joinpath(STDLIB_DIR, stdlib, "Project.toml"))