Skip to content

Instantly share code, notes, and snippets.

@Matsuyanagi
Matsuyanagi / markdown filter
Created January 27, 2021 15:40
Create Link markdown
name:
markdown
Format:
%title%\n%url%
filter:
const matches = s.match( /^(.+)\n([^\n]+)$/ );let title = matches[ 1 ];let url = matches[ 2 ];if ( url.match(/^https:\/\/www\.amazon\.co\.jp.*\/(dp|gp|ASIN|product)/) ){const dp_matches = url.match( /\/(dp|gp|ASIN|product)\/([0-9A-Z]{10})([^0-9A-Z])/ );const dp = "dp/" + dp_matches[ 2 ] + "/";url = "https://www.amazon.co.jp/" + dp;title = title.replace( / \| .*$/, "");title = title.replace( /[A-Za-z0-9]/g, c => String.fromCharCode(c.charCodeAt(0) - 0xFEE0) );title = title.replace( / /g, " ");}return "[" + title + "](" + url + ")";
{
"configurations": [
{
"name": "Win32",
"defines": [
"_DEBUG",
"UNICODE",
"_UNICODE"
],
"windowsSdkVersion": "10.0.18362.0",
@Matsuyanagi
Matsuyanagi / CreateLinkFilter_date_time.js
Last active January 6, 2018 17:58
CreateLink で $%date%$ 日付、$%time%$ 時刻を置き換えるフィルタ
return ((s)=>{const d = new Date();const yyyy = d.getFullYear();const mm = ("0"+(d.getMonth()+1)).slice(-2);const dd = ("0"+d.getDate()).slice(-2);const date = `${yyyy}-${mm}-${dd}`;const hh = ("0"+d.getHours()).slice(-2);const mi = ("0"+d.getMinutes()).slice(-2);const sc = ("0"+d.getSeconds()).slice(-2);const time = `${hh}:${mi}:${sc}`;s = s.replace( /\$%date%\$/, date );s = s.replace( /\$%time%\$/, time );return s;})(s);
/*
return (
(s)=>{
const d = new Date();
const yyyy = d.getFullYear();
const mm = ("0"+(d.getMonth()+1)).slice(-2);
const dd = ("0"+d.getDate()).slice(-2);
const date = `${yyyy}-${mm}-${dd}`;
@Matsuyanagi
Matsuyanagi / gz_read.rb
Created September 16, 2015 05:02
ruby gz file read
# gz 圧縮ファイル展開しながら読み込み
require 'zlib'
filename_gz = "mysql-bin.000004.sql.gz"
lineno = 0
Zlib::GzipReader.open( filename_gz ) do |gz|
gz.each do |line|
lineno += 1
if /reg/i === line
@Matsuyanagi
Matsuyanagi / skelton.rb
Created September 16, 2015 05:00
ruby skeleton
#!/usr/bin/env ruby
# -*- coding: utf-8 -*-
#-----------------------------------------------------------------------------
#
#
#
# 2015-09-16
#-----------------------------------------------------------------------------
require 'pp'
require 'fileutils'