Skip to content

Instantly share code, notes, and snippets.

View usagizmo's full-sized avatar

usagizmo

View GitHub Profile
@usagizmo
usagizmo / format-photos.ts
Last active October 14, 2023 17:37
[動画/写真] メタ情報から DateTimeOriginal/作成日/更新日 の指定とファイル名の変更
View format-photos.ts
import { execSync } from 'child_process';
import fs from 'node:fs/promises';
import _fs from 'fs';
import path from 'path';
import { parse, isBefore, format, isValid } from 'date-fns';
const directoryPath = __dirname + '/files';
const files = await fs.readdir(directoryPath);
View git-skip-commands.sh
# assume-unchanged: リポジトリが更新された場合、作業ツリー上の更新を破棄する
git update-index --assume-unchanged [FILENAME]
git update-index --no-assume-unchanged [FILENAME]
# skip-worktree: リポジトリが更新された場合、作業ツリー上の更新を保つ
git update-index --skip-worktree [FILENAME]
git update-index --no-skip-worktree [FILENAME]
# Check file ignore status
git ls-files -v
@usagizmo
usagizmo / package.json
Last active August 31, 2018 14:32
Execute docker bash and save database sample
View package.json
{
"scripts": {
"save": "did=`docker ps | awk '$2==\"mysql:5.7\" { print $1 }'` && docker exec -it $did sh -c 'mysqldump wordpress -u wordpress -pwordpress 2> /dev/null' > ./docker-entrypoint-initdb.d/install_wordpress.sql",
"bash": "did=`docker ps | awk '$2==\"wordpress:latest\" { print $1 }'` && docker exec -it $did bash"
}
}
View remove_ds_store.sh
sudo find . -name ".DS_Store" -depth -exec rm {} \;
View .editorconfig
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
indent_size = 2
indent_style = space
insert_final_newline = true
View sublime.log_commands
sublime.log_commands(True)
View find_and_chmod.sh
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \;
View send_mail.php
<?php
// 言語、文字コードを設定する
mb_language('uni');
mb_internal_encoding('UTF-8');
function map_htmlspecialchars($request)
{
return array_map(function ($value) {
return is_array($value) ?
map_htmlspecialchars($value) :
View .htaccess
<Files ~ "^\.(htaccess|htpasswd)$">
deny from all
</Files>
Options -Indexes
AuthUserFile /var/www/html/.htpasswd
# AuthGroupFile /dev/null
AuthName "Please enter your ID and password"
AuthType Basic
require valid-user
order deny,allow