Skip to content

Instantly share code, notes, and snippets.

View miladoll's full-sized avatar

MILA DOLL DECCHI miladoll

View GitHub Profile
@miladoll
miladoll / abeneko.js
Last active January 9, 2024 08:48
あべねこ
// Visit http://abehiroshi.la.coocan.jp/
// then execute these lines via DevTools Console.
let e = document.createElement('img');
e.src = 'https://gist.github.com/assets/25242343/14cbd41c-1ec4-4f13-8bce-ae8a726b2524';
e.style.cssText = 'width: 60%; margin-left: 20%; margin-right: 20%; position: absolute; filter: drop-shadow( 0 0 10px white );';
let eHead = document.getElementsByTagName('head')[0];
eHead.parentNode.insertBefore( e, eHead.nextElementSibling );
@miladoll
miladoll / 結果が見えぬか消える.json
Created September 24, 2021 03:47
結果が見えぬか消える.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "echo",
"type": "shell",
"presentation": {
"reveal": "always",
{
BOOTH_ORDER :
{
captures : {
subject : {
unpaid : {
rule : '^.*((お支払い未完了)).*$',
rule_opt : 'gsm',
default_value : '支払済み',
value : '支払未完了'
@miladoll
miladoll / OpenGraph.php.patch
Created March 1, 2021 07:45
https://github.com/scottmac/opengraph/blob/master/OpenGraph.php へのdirty patch。EUC-JP、ShiftJISのサイトへ対応
diff --git "a/vendor/opengraph/OpenGraph.php" "b/vendor/opengraph/OpenGraph.php"
index aa16e55..92ccdff 100644
--- "a/vendor/opengraph/OpenGraph.php"
+++ "b/vendor/opengraph/OpenGraph.php"
@@ -61,6 +61,20 @@ class OpenGraph implements Iterator
curl_setopt($curl, CURLOPT_USERAGENT, $_SERVER['HTTP_USER_AGENT']);
$response = curl_exec($curl);
+ $suspicious_charset = '';
+ preg_match(
@miladoll
miladoll / benchmark_wc_vs_stat.sh
Created September 9, 2020 07:42
bashではstatを使うよりwc -cでPOSIX準拠にファイルサイズを取得したほうが速かったっぽい
$ ls -l test.jpg
-rwxrwxrwx 1 hoge hoge 756448 Sep 9 13:36 test.jpg
$ time ( for i in `seq 10000`; do wc -c test.jpg > /dev/null;done )
real 0m14.854s
user 0m4.216s
sys 0m4.275s
$ time ( for i in `seq 10000`; do stat -c%s test.jpg > /dev/null;done )
real 0m18.041s
@miladoll
miladoll / WordPress_Disable_Texturize_in_Gutenberg.php
Created September 8, 2020 11:18
WordPressの余計なwptexturizeは元から絶たなきゃダメ!
/*
WordPressの wptexturize とか wpautop とか呼ばれる機能停止して
ダブルクオートとかダッシュとかの自動変換を止めるねん
Gutenbergにも対応する版
*/
call_user_func( function() {
add_filter( 'run_wptexturize', '__return_false', PHP_INT_MAX );
// 勝手に改行を <p></p> にしたりするのを止める
add_action('init', function() {
remove_filter('the_title', 'wpautop');
@miladoll
miladoll / something.conf
Created July 19, 2020 09:18
ぼくのかんがえたかっこいいWordPress管理ページアクセス拒否.conf
// safe_hosts.conf
geo $safe_hosts {
default 0;
127.0.0.1 1;
# : etc.
}
// is_wordpress_admin_page.conf
map $uri $is_wordpress_admin_page {
default 0;
# Nginx で
# www.hogehoge.com -> hogehoge.com
# http://{www.}hogehoge.com -> https://hogehoge.com
# に一気に正規化する設定の例
# server コンテキスト
set $redirect_canon_url "";
set $canon_host $host;
if ( $host ~ ^www\.(.*)$ ) {
#!/bin/bash
: <<__WHAT_IS_THIS__
Cloudflareの公開情報から以下のファイルを作成する。
/etc/cron.daily/ に置いてね
* /etc/nginx/conf.d/00-trusted_proxies.conf
Cloudflareからのアクセスの場合、
X-Cloudflare-Proxy-IP から
リモートIPアドレスをHTTPヘッダに引き継がせる
@miladoll
miladoll / change_resolv.conf_search.sh
Last active July 15, 2020 04:13
resolv.conf searchの正しい変更お作法 (debian 10, buster / Ubuntu 20)
# local DNS stub listener を無効にする
if lsof -i:53 | grep -q systemd-resolve; then
sed -i \
-e 's|^#\(DNSStubListener=\).*$|\1no|' \
/etc/systemd/resolved.conf
resolve_conf_real_path=$(readlink /etc/resolv.conf)
# なおかつ /etc/resolv.conf を stub ではないものを参照させる
if [[ "$resolve_conf_real_path" =~ stub-resolv.conf$ ]]; then
(
cd /etc