This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
def create_iptime_block_rules(ip_range, title_prefix): | |
output = "Type=firewall # Do not modify\n" + \ | |
"Version=1.0.0 # Do not modify\n" + \ | |
"lang=utf-8 # Do not modify\n\n" | |
for index, ip in enumerate(ip_range): | |
output += "[{0} {1}]\n".format(title_prefix, 1 + index) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
k1 = 'ABCDEag==' | |
k2 = 'ABCDEag==' | |
print('Length of k1:', len(k1)) | |
print('Length of k2:', len(k2)) | |
print('--- k1:') | |
for c in k1: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="ko"> | |
<head> | |
<title>또 하나의 웹사이트</title> | |
<meta charset="UTF-8"> | |
<meta name="robots" content="noindex,nofollow"> | |
<meta name="viewport" | |
content="width=device-width, initial-scale=1.0, user-scalable=yes"> | |
<style> | |
body { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: 메타 값 체크 예제 | |
* Plugin URI: https://gist.github.com/chwnam/2fb5cf06237a43671875c3baf12dca35 | |
* Description: 메타 값 저장 후 체크 예시 | |
* Author: changwoo | |
* Author URI; https://blog.changwoo.pe.kr | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: OR 키워드 검색 | |
* Description: 입력된 키워드를 OR 조건으로 검색합니다. | |
* Author: changwoo | |
* Author URI: https://blog.changwoo.pe.kr | |
*/ | |
if ( ! defined( 'ABSPATH' ) ) { | |
exit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: My CPT with custom permalink. | |
* Description: Change permalink from /cpt/%postname% to /cpt/%post_id%. | |
*/ | |
add_action( 'init', 'my_cpt_init' ); | |
function my_cpt_init() { | |
register_post_type( | |
'my-cpt', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Changwoo Blog 1일1워프 포스팅 | |
# https://blog.changwoo.pe.kr/wp-install/ | |
if [[ $# -ne 1 ]]; then | |
echo "Input name, please." | |
exit | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Plugin Name: wp-util-sample | |
* Description: wp.util sample code. | |
*/ | |
add_action('admin_menu', 'wp_util_sample_menu'); | |
function wp_util_sample_menu() | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 말단 텀 이외에 찍힌 것 제거 | |
* | |
* @param int $post_id | |
* @param string $taxonomy | |
* | |
* @return WP_Term[] | |
*/ | |
function get_mid_terms( int $post_id, string $taxonomy = 'category' ): array { | |
$terms = wp_get_object_terms( $post_id, $taxonomy ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Plugin Name: Race Cond | |
* Plugin URI: https://gist.github.com/chwnam/c441ca20952856ca0e1a9cd0d657fac9 | |
* | |
* @link https://blog.changwoo.pe.kr/option-race-condition/ | |
*/ | |
add_action( 'admin_menu', 'rcond_admin_menu' ); | |
function rcond_admin_menu() { |
NewerOlder