Skip to content

Instantly share code, notes, and snippets.

@p-baleine
p-baleine / index.js
Created September 26, 2020 03:43
org-roam capture script
javascript:(function() {
try {
const maxTitleLength = 52;
const title = document.title.length > maxTitleLength ?
`${document.title.slice(0, maxTitleLength)}...` : document.title;
const href = document.location.href;
const hashFragment = document.location.hash ?
` | ${document.location.hash}` : '';
const text = `${title}${hashFragment}`;
const linkText = `[[${href}][${text}]]`;
@p-baleine
p-baleine / Makefile
Last active November 7, 2024 10:38
libjq と戯れる、その 1
CC = $(shell ls *.cc)
BIN = $(CC:%.cc=bin/%)
LINK_FLAGS = -ljq -lpthread -lonig
all: $(BIN)
bin/%: %.cc libjq.a libonig.a
clang++ -v -Wall -O2 -o $@ -L. -I. $< ${LINK_FLAGS}
%.o: %.cc
@p-baleine
p-baleine / aws-sdk-2.709.0.min.js
Created July 5, 2020 10:18
AWS SDK JS v2.709.0, Athena build.
_xamzrequire=function(){function e(t,r,n){function i(s,a){if(!r[s]){if(!t[s]){var u="function"==typeof require&&require;if(!a&&u)return u(s,!0);if(o)return o(s,!0);var c=new Error("Cannot find module '"+s+"'");throw c.code="MODULE_NOT_FOUND",c}var l=r[s]={exports:{}};t[s][0].call(l.exports,function(e){return i(t[s][1][e]||e)},l,l.exports,e,t,r,n)}return r[s].exports}for(var o="function"==typeof require&&require,s=0;s<n.length;s++)i(n[s]);return i}return e}()({38:[function(e,t,r){(function(r){function n(e,t){if("string"==typeof e){if(["legacy","regional"].indexOf(e.toLowerCase())>=0)return e.toLowerCase();throw o.util.error(new Error,t)}}function i(e,t){e=e||{};var i;if(e[t.clientConfig]&&(i=n(e[t.clientConfig],{code:"InvalidConfiguration",message:'invalid "'+t.clientConfig+'" configuration. Expect "legacy" or "regional". Got "'+e[t.clientConfig]+'".'})))return i;if(!o.util.isNode())return i;if(Object.prototype.hasOwnProperty.call(r.env,t.env)){if(i=n(r.env[t.env],{code:"InvalidEnvironmentalVariable",message:
@p-baleine
p-baleine / cyberia.js
Last active July 5, 2020 03:42
Cyberia
javascript:(function() { const bg = document.createElement('div'); const noiseSecond = 5; function charHtml(c) { let classes = 'c-container'; if (c === '') classes += ' await'; return `<div class="${classes}"> <div class="c">${c}</div> <div class="prompt">&#x02588;</div></div>`.trim(); } const line1 = [ 'ソ', 'ウ', 'ダ', '' ].map(charHtml).join('\n'); const line2 = [ 'サ', 'イ', 'ベ', 'リ', 'ア', '、', 'イ', 'コ', 'ウ', '。', '' ].map(charHtml).join('\n'); bg.innerHTML = `<div class="cyberia"> <style> @keyframes noise { 0% { opacity: 0 } 10% { opacity: .1 } 70% { opacity: .8 } 71% { opacity: .3 } /* ☆ */ 72% { opacity: .8 } 77% { opacity: .8 } 78% { opacity: .3 } /* ☆ */ 81% { opacity: .8 } 84% { opacity: .8 } 85% { opacity: .3 } /* ☆ */ 87% { opacity: .8 } 95% { opacity: .8 } 100% { opacity: 0 } } @keyframes lain { 0% { opacity: 0 } 70% { opacity: 0 } 71% { opacity: .8 } /* ☆ */ 72% { opacity: .3 } 78% { opacity: .8 } /* ☆ */ 81% { opacity: 0 } 85% { opacity: .8 } /* ☆ */ 100% { opacity: 0 } } @keyframes copy { 0% { opac
@p-baleine
p-baleine / talert.js
Last active July 2, 2020 21:28
任意のページに「東京アラート」を表示するスクリプト(ブックマークレット)
javascript:(function() {const talert = document.createElement('div');talert.innerHTML = '<div><style>@keyframes talert1 {0%{transform: translateY(-50rem)}100%{transform: translateY(100vh)}}@keyframes talert2 {0%{opacity: 0}50%{opacity: 1}}</style><div style="font-size:2.5rem;color:#f00;writing-mode:vertical-lr;position:absolute;top:0;right:0;z-index:99999;padding:1rem;background-color:#000000b0;height:200rem;"><div style="animation: talert1 15s linear -.1s infinite, talert2 1.5s linear -.1s infinite;">◆◆◆&nbsp;東京アラートを再発動いたしました。不要不急の外出は控えてください。&nbsp;◆◆◆</div></div></div>';document.body.appendChild(talert.firstChild);}())
@p-baleine
p-baleine / hoge.html
Last active May 12, 2020 14:43
「早くタップすると逆になっちゃうやつ」の解決案、あと玲音
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<style>
html {
font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-serif,Apple Color Emoji,Segoe UI Emoji;
font-size: 32px;
}
@p-baleine
p-baleine / index.html
Created April 20, 2020 02:01
An example of tangbc/vue-virtual-scroll-list@2.0 + SortableJS/Sortable
<!doctype html>
<html>
<head>
<script src="https://unpkg.com/vue@2.6.11"></script>
<script src="https://unpkg.com/vue-virtual-scroll-list"></script>
<script src="https://cdn.jsdelivr.net/npm/sortablejs@latest/Sortable.min.js"></script>
<script src="https://cdn.rawgit.com/Marak/faker.js/v4.1.0/examples/browser/js/faker.min.js"></script>
<style>
html {
font: 16px/1.6 Helvetica Neue,Helvetica,Arial,sans-serif;
@p-baleine
p-baleine / utils.py
Created June 20, 2018 21:08
読書メモ〜『情報検索の基礎』 第1章 2
import glob
import os
import re
import pandas as pd
import string
def tokenize(line):
return line.split()
def normalize(line):
@p-baleine
p-baleine / boolean_retrieval_model.py
Created June 20, 2018 21:08
読書メモ〜『情報検索の基礎』 第1章 1
# p.3、論理検索モデル(Boolean retrieval model)
import glob
import os
DATA_PATH = '../data/Boolean_Retrieval/shakespeare_collection'
DOCUMENTS = [
'Tragedies/Antony and Cleopatra',
'Tragedies/Julius Caesar',
@p-baleine
p-baleine / boolean_retrieval_model.py
Last active June 20, 2018 21:06
読書メモ〜『情報検索の基礎』 第1章
# p.3、論理検索モデル(Boolean retrieval model)
import glob
import os
DATA_PATH = '../data/Boolean_Retrieval/shakespeare_collection'
DOCUMENTS = [
'Tragedies/Antony and Cleopatra',
'Tragedies/Julius Caesar',