Skip to content

Instantly share code, notes, and snippets.

@lyo
lyo / favon_ldr.user.js
Created February 17, 2021 15:58 — forked from shokai/favon_ldr.user.js
Fav on LDR
// ==UserScript==
// @name Favon LDR
// @namespace http://hoge.sub.jp/blog/
// @description add to twitter's favorites on LDR
// @include http://reader.livedoor.com/reader/*
// @include http://fastladder.com/reader/*
// @resource star http://assets0.twitter.com/images/icon_star_full.gif
// @version 0.0.3
// ==/UserScript==
@lyo
lyo / letter_frequency.py
Created November 15, 2020 06:33
アルファベット出現頻度確認
import collections, sys
from string import ascii_lowercase
def filecharcount(openfile):
return sorted(collections.Counter(char for line in
openfile for char in line.lower() ).items())
f = open(sys.argv[1])
for letter, repetitions in filecharcount(f):
print(letter, repetitions)
@lyo
lyo / drag_n_drop.html
Last active June 21, 2020 04:08 — forked from ragklaat/drag_n_drop.html
Drag & drop images to HTML5 canvas
<!doctype html>
<html>
<head>
<title>Drag n drop test</title>
<style type="text/css">
body {text-align: center; padding-top: 100px;}
em {position: absolute; bottom: 0; right: 0}
canvas { border: 1px solid black; }
</style>
# to see
# https://www.pediatricsurgery.site/entry/2018/03/04/133703
# https://mrunadon.github.io/ggplot2/
# https://sugioka.wiki.fc2.com/wiki/ggplot2でviolinplotを描く
ggplot()+theme_set(theme_bw(base_size = 14))
mean_fun <- function(x){
return(data.frame(y = min(x)+0.5, label = paste0(round(mean(x),1))))
}
# somewhat hackish solution to:
# https://twitter.com/EamonCaddigan/status/646759751242620928
# based mostly on copy/pasting from ggplot2 geom_violin source:
# https://github.com/hadley/ggplot2/blob/master/R/geom-violin.r
library(ggplot2)
library(dplyr)
"%||%" <- function(a, b) {
@lyo
lyo / Makefile.PL
Created November 12, 2012 15:34
PerlMagick Build.PL_customize
# Copyright 1999-2012 ImageMagick Studio LLC, a non-profit organization
# dedicated to making software imaging solutions freely available.
#
# You may not use this file except in compliance with the License. You may
# obtain a copy of the License at
#
# http://www.imagemagick.org/script/license.php
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@lyo
lyo / KERNEL_config.diff
Created October 9, 2010 10:09
ZFS用にカーネルアドレス空間サイズを変更
--- GENERIC 2010-06-14 11:09:06.000000000 +0900
+++ i386_ZFS_KERNEL 2010-10-09 19:08:07.568827820 +0900
@@ -21,7 +21,7 @@
cpu I486_CPU
cpu I586_CPU
cpu I686_CPU
-ident GENERIC
+ident i386_ZFS_KERNEL
# To statically compile in device wiring instead of /boot/device.hints
@lyo
lyo / portsnap.conf.diff
Created October 9, 2010 07:53
portsnap.conf変更
--- portsnap.conf.orig 2010-10-09 16:51:22.408553978 +0900
+++ portsnap.conf 2010-10-09 16:52:33.721948279 +0900
@@ -26,8 +26,8 @@
# directives and experience problems, remove them and update your tree
# before asking for help on the mailing lists.
#
-# REFUSE arabic chinese french german hebrew hungarian japanese
-# REFUSE korean polish portuguese russian ukrainian vietnamese
+REFUSE arabic chinese french german hebrew hungarian
+REFUSE korean polish portuguese russian ukrainian vietnamese
@lyo
lyo / sshd_config.diff
Created October 9, 2010 07:10
sshd_condig変更
--- /etc/ssh/sshd_config.old 2010-10-09 16:03:06.146720701 +0900
+++ /etc/ssh/sshd_config 2010-10-09 16:09:31.423106107 +0900
@@ -42,7 +42,7 @@
# Authentication:
#LoginGraceTime 2m
-#PermitRootLogin no
+PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6
@lyo
lyo / install_memo.sh
Created October 7, 2010 15:49
FreeBSD+Root on ZFS環境構築メモ
#FreeBSD+Root on ZFS
#install memo
#ad0 と da0(USB)の表示確認
gpart show
#対象を絞って...
gpart show ad0
#前回分削除
gpart delete -i 1 ad0