Skip to content

Instantly share code, notes, and snippets.

View miya0001's full-sized avatar

Takayuki Miyauchi miya0001

View GitHub Profile
@miya0001
miya0001 / gist:3988074
Created October 31, 2012 16:29
のぼりんに教えてもらった.bash_historyからコマンドの使用回数ベストテン
cut -d ' ' -f1 ~/.bash_history | sort | uniq -c | sort -r | head -n 10
@miya0001
miya0001 / cors-for-the-wordpress-rest-api.php
Last active January 31, 2023 07:42
CORS for the WordPress REST API
<?php
function my_customize_rest_cors() {
remove_filter( 'rest_pre_serve_request', 'rest_send_cors_headers' );
add_filter( 'rest_pre_serve_request', function( $value ) {
header( 'Access-Control-Allow-Origin: *' );
header( 'Access-Control-Allow-Methods: GET' );
header( 'Access-Control-Allow-Credentials: true' );
header( 'Access-Control-Expose-Headers: Link', false );
@miya0001
miya0001 / switch-lacale.php
Created October 2, 2011 05:55
WordPressでサイト側の言語を英語に設定しつつadmin_barは日本語で表示する。
<?php
/*
Plugin Name: Switch Locale
Author: Takayuki Miyauchi
Plugin URI: http://firegoby.theta.ne.jp/wp/switch-locale
Description: Set selected langs for your site.
Author: Takayuki Miyauchi
Version: 0.1.0
Author URI: http://firegoby.theta.ne.jp/
Domain Path: /languages
@miya0001
miya0001 / sample.geojson
Created May 20, 2022 05:33
東京都港区内の消火栓
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@miya0001
miya0001 / setup.sh
Created February 12, 2022 08:20
setup Raspberry Pi as Kosk
#!/usr/bin/env bash
set -ex
sudo apt update
sudo apt upgrade -y
sudo apt purge wolfram-engine scratch nuscratch sonic-pi idle3 -y
sudo apt purge smartsim java-common libreoffice* -y
@miya0001
miya0001 / example.com.conf
Created October 14, 2011 08:44
nginx+リバースプロキシでバーチャルホスト
#
# A virtual host using WordPress
# /etc/nginx/conf.d/example.com.conf
#
server
{
listen 8080;
client_max_body_size 10m;
server_name .example.com;
@miya0001
miya0001 / setup.sh
Last active January 7, 2022 19:28
Raspberry Pi as a Kiosk
#!/usr/bin/env bash
set -ex
sudo raspi-config nonint do_change_locale ja_JP.UTF-8
sudo apt update
sudo apt upgrade -y
sudo apt purge wolfram-engine scratch nuscratch sonic-pi idle3 smartsim java-common libreoffice* -y
{
"version": 8,
"name": "Geolonia Basic",
"metadata": {},
"sources": {
"natural-earth": {
"type": "vector",
"maxzoom": 6,
"url": "https://cdn.geolonia.com/tiles/natural-earth.json"
},
@miya0001
miya0001 / class-addpage.php
Created March 3, 2012 13:27
WordPressに独自のページを表示する
<?php
if (!class_exists('WP_AddPage')):
class WP_AddPage {
private $rule = null;
private $title = null;
private $callback = null;
private $template = null;
private $filter = false;