Skip to content

Instantly share code, notes, and snippets.

View taskie's full-sized avatar
๐ŸŒ
๐‘ฉ๐‘ณ๐‘จ๐’๐‘ฐ๐‘ต๐‘ฎ ๐‘ญ๐‘จ๐‘บ๐‘ป

taskie taskie

๐ŸŒ
๐‘ฉ๐‘ณ๐‘จ๐’๐‘ฐ๐‘ต๐‘ฎ ๐‘ญ๐‘จ๐‘บ๐‘ป
View GitHub Profile
@taskie
taskie / solarized.py
Last active October 14, 2016 09:41
Tiny Converter for Solarized Color Scheme
#!/usr/bin/env python3
#SOLARIZED HEX 16/8 TERMCOL XTERM/HEX L*A*B RGB HSB
#--------- ------- ---- ------- ----------- ---------- ----------- -----------
solstr = """
base03 #002b36 8/4 brblack 234 #1c1c1c 15 -12 -12 0 43 54 193 100 21
base02 #073642 0/4 black 235 #262626 20 -12 -12 7 54 66 192 90 26
base01 #586e75 10/7 brgreen 240 #585858 45 -07 -07 88 110 117 194 25 46
base00 #657b83 11/7 bryellow 241 #626262 50 -07 -07 101 123 131 195 23 51
base0 #839496 12/6 brblue 244 #808080 60 -06 -03 131 148 150 186 13 59
@taskie
taskie / get_raw_bytes.rs
Created January 24, 2017 13:16
Rust ใงใƒกใƒขใƒชไธŠใฎ็”Ÿใฎใƒใ‚คใƒˆๅˆ—ใ‚’่ฆ‹ใ‚‹ใ‚„ใค
fn get_raw_bytes<T>(p: *const T) -> Vec<u8> {
// https://www.reddit.com/r/rust/comments/2ngnmk/viewing_any_object_as_a_raw_memory_array/
let size = std::mem::size_of::<T>();
let mut buf = Vec::with_capacity(size);
let view = p as *const _ as *const u8;
for i in 0..size {
buf.push(unsafe {*view.offset(i as isize)});
}
buf
}
@taskie
taskie / PukiWiki.hs
Last active February 14, 2017 11:56
PukiWiki Reader for Pandoc๏ผˆ้›‘๏ผ‰
{-# LANGUAGE RelaxedPolyRec, FlexibleInstances, TypeSynonymInstances #-}
-- RelaxedPolyRec needed for inlinesBetween on GHC < 7
{-
Copyright (C) 2012-2015 John MacFarlane <[email protected]>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
@taskie
taskie / abcde.conf.sh
Created February 27, 2017 12:04
my abcde.conf
# ref.) http://www.andrews-corner.org/abcde.html
ACTIONS=cddb,playlist,read,encode,tag,move,clean
# cddb
CDDBURL="http://freedbtest.dyndns.org/~cddb/cddb.cgi"
CDDBCOPYLOCAL="y"
CDDBLOCALDIR="/data/media/abcde/cddb"
CDDBLOCALRECURSIVE="y"
CDDBUSELOCAL="y"
import io
import subprocess
import functools
import copy
import os
import sys
from collections import ChainMap
__version__ = '0.0.1'
_debug = False
export type State<Source> = {
source: Source;
position: number;
completed: boolean;
};
export function State<Source>(
source: Source,
position?: number
): State<Source> {
@taskie
taskie / bashism.sh
Last active October 28, 2018 18:01
#!/usr/bin/env bash
# for GNU bash 3.x on Linux
declare PROGRAM_NAME="$(basename "$0")"
declare PROGRAM_DIR="$(realpath "$(dirname "$0")")"
function usage () {
cat <<EOF
${PROGRAM_NAME} - some nice program
@taskie
taskie / dcp.sh
Last active October 30, 2018 15:33
diff then cp
set -eu
PROGRAM="$(basename "$0")"
usage () {
cat <<EOF
${PROGRAM}: diff then cp
Usage:
${PROGRAM} [-f|-i] SRC DEST
@taskie
taskie / dcp.bash
Last active October 30, 2018 16:34
diff then cp (bash)
#!/usr/bin/env bash
set -eu
PROGRAM="$(basename "$0")"
usage () {
cat <<EOF
${PROGRAM}: diff then cp
Usage:
package main
import (
"bufio"
"bytes"
"encoding/json"
"fmt"
"os"
log "github.com/sirupsen/logrus"