Skip to content

Instantly share code, notes, and snippets.

View ahgood's full-sized avatar

Guojun ahgood

  • Fullstack Developer
  • Halifax
View GitHub Profile
@nishinoshake
nishinoshake / readme.md
Last active July 5, 2017 04:40
PostfixとProcmailで迷惑メールの振り分け

Procmailとは

メールの振り分けをしてくれるソフトウェア。
設定ファイルにルールを記載するとよきに計らってくれる。

インストール

yum install procmail

Postfixの設定

# procmailのパス調べる

which procmail

@tatemz
tatemz / docker-wpcli.sh
Last active December 18, 2020 06:59
A quick way to use one-off wp-cli commands with Docker. See Part 1: https://gist.github.com/tatemz/504383c921aa5898c49b82d4ee181362
#!/bin/bash
cd wordpress-site
cat >> docker-compose.yml <<EOL
my-wpcli:
image: tatemz/wp-cli
volumes_from:
- my-wp
links:
@tatemz
tatemz / docker-wordpress.sh
Last active April 14, 2025 11:18
A quick way to get a WordPress installation up and running with Docker
#!/bin/bash
mkdir wordpress-site && cd wordpress-site
touch docker-compose.yml
cat > docker-compose.yml <<EOL
version: "2"
services:
my-wpdb:
@pokka
pokka / wechat-browser-detect.js
Last active January 20, 2025 17:27 — forked from cary929/wechat-browser-detect.js
JavaScript 判断是否微信内置浏览器
// 使用 userAgent 判断是否微信内置浏览器
if( navigator.userAgent.toLowerCase().indexOf('micromessenger') > -1 || typeof navgator.wxuserAgent !== "undefined" ) {
return true;
}
@cpmpercussion
cpmpercussion / loop_pi_video.sh
Created July 15, 2016 08:31
omxplayer command to loop a video forever for use in video art exhibitions
#!/bin/bash
# This one-liner script plays a video in an infinite loop on a raspberry pi
# for a video-art exhibition.
# It was written for a video in portrait orientation so the video is rotated 270
# to use up the whole screen (which was also rotated).
# Charles Martin, July 2016
omxplayer -o local --loop /home/pi/video.mp4 --orientation 270
@atomtigerzoo
atomtigerzoo / wordpress-disable-yoast-seo-on-custom-post-type.php
Created March 31, 2016 12:39
Wordpress: Disable Yoast SEO on Custom Post Type
function my_remove_wp_seo_meta_box() {
remove_meta_box('wpseo_meta', YOUR_POST_TYPE_NAME_HERE, 'normal');
}
add_action('add_meta_boxes', 'my_remove_wp_seo_meta_box', 100);
@macghriogair
macghriogair / gist:7909f5c24f8c742ce2e6
Created March 20, 2016 14:23
stream csv file lumen
<?php
namespace App\Http\Controllers;
use App\Result;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\StreamedResponse;
class ExportController extends Controller
{
@eteeselink
eteeselink / delay.js
Created November 13, 2015 13:55
ES7 async/await version of setTimeout
const delay = ms => new Promise(resolve => setTimeout(resolve, ms));
async function something() {
console.log("this might take some time....");
await delay(5000);
console.log("done!")
}
something();
@tdebatty
tdebatty / get_ip.php
Last active May 12, 2022 08:26
PHP : Get IP from interface
// !! this gist was created in 2015, it doesn't work on most modern distributions !!
// e.g: get_ip("eth0");
function get_ip($interface) {
$interface = escapeshellarg($interface);
$pattern = "/inet addr:(\d+\.\d+\.\d+\.\d+)/";
$text = shell_exec("ifconfig $interface");
preg_match($pattern, $text, $matches);
return $matches[1];
}
@facine
facine / __INDEX.txt
Last active August 28, 2024 05:45
Drupal 8 - Examples
# Taxonomy terms:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_taxonomy_term-php
# Menu links:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_menu_link-php
# File items:
- https://gist.github.com/facine/35bb291811c146b6fc9e#file-create_file-php
# Nodes: