Skip to content

Instantly share code, notes, and snippets.

@hogashi
hogashi / orca-19W11-048367.orca
Created November 14, 2019 16:16
orca 2019-11-15
.......................................................................
.......................................................................
........1..............................................................
.......................................................................
.......................................................................
.........B.............................................................
.........102GSE........................................................
.............SE.E.E.E.E.E.E;04C........................................
.......................................................................
...............;04F96..................................................
@hogashi
hogashi / update-cache-script.sh
Last active June 2, 2019 07:10
update cache script
export URL_PREPARE="/update-cache/c/s/hogas.mydns.jp/article?amp_action=flush&amp_ts=$(date +%s)" &&
curl -vvv "https://hogas-mydns-jp.cdn.ampproject.org${URL_PREPARE}$(
echo -n "&amp_url_signature=$(
echo -n $URL_PREPARE | openssl dgst -sha256 -sign path/to/private-key.pem |
openssl enc -a -A | tr -d '=' | tr '/+' '_-' # base64-urlsafe
)"
)"
javascript:(() =>
Array.from(document.getElementsByClassName('sha btn'))
.reverse()
.reduce((promise, a) =>
promise.then(() =>
window.open(`${a.href}?w=1`)
)
, Promise.resolve())
)()
@hogashi
hogashi / hist-rev-search-fzf.bash
Created March 19, 2019 07:40
重複を(なんとなく)除きつつヒストリ順にfzf コマンド名でソートした後にuniqするだけなので完全には重複を除けてない
function reverse-search-history-with-fzf ()
{
FZF_RESULT=$(history | sort -k2 | uniq -f 2 | sort -k1 -n -r | perl -pe 's/^(\s+)?[0-9]+\s+//g' | fzf);
BEFORE_CURSOR=${READLINE_LINE:0:$READLINE_POINT};
AFTER_CURSOR=${READLINE_LINE:$READLINE_POINT};
READLINE_LINE=${BEFORE_CURSOR}${FZF_RESULT}${AFTER_CURSOR};
(( READLINE_POINT += ${#FZF_RESULT} ))
}
bind -x '"\C-r": reverse-search-history-with-fzf'
@hogashi
hogashi / picture-in-picture.js
Created March 11, 2019 10:17
bookmarklet; request picture-in-picture to video tag which has src
javascript:(
() => Array.from(document.querySelectorAll('video')).find(v => v.src).requestPictureInPicture()
)()
javascript:(
() => {
/* get ingredients */
const url = location.href;
const issueNumber = url.match(/\/([0-9]+)/)[1];
const title = document.querySelector('.js-issue-title').innerText.trim();
/* make inputElem to select the value which will be copied */
const inputElem = document.createElement('input');
document.querySelector('body').appendChild(inputElem);
@hogashi
hogashi / sb2puki.js
Last active February 12, 2019 00:47
Scrapbox to PukiWiki written in JavaScript
// sb2puki
// EDIT HERE
const sb = `scrapbox page title
put your scrapbox text here
code:index.js
const test1 = 3;
console.log(test1);
@hogashi
hogashi / tweet-now-browsing.js
Last active September 29, 2019 07:56
Tweets NowBrowsing
javascript:(() => {
const url = window.location.href;
const title = document.title;
/* EDIT HERE: tweet-text template */
const text = encodeURIComponent(` / "${title}" - ${url}`);
/* EDIT HERE: tweet window */
/* 'tw_p=tweetbutton' for auto-close */
window.open(`https://twitter.com/intent/tweet?text=${text}&tw_p=tweetbutton`, '_blank', 'width=450, height=250');
})();
@hogashi
hogashi / add-column-icon-in-tweetdeck.js
Created January 20, 2019 05:55
TweetDeck でカラムに所有者のアイコンを表示するブックマークレット
javascript:(() => {
const urlSet = {};
/* アイコンのURLを取得する */
Array.from(document.querySelectorAll('.js-account-list .js-account-item')).forEach(item => {
const img = item.querySelector('img');
urlSet[item.title] = img.src;
});
/* アイコンのクラス名 */
const iconClassName = 'column-header-title-icon';
/* アイコンを置く */

Twitter 公式 Web ホームタイムライン新レイアウト

画像ツイートの画像までの構造

html
 body
  div#react-root
   h2
   div