Skip to content

Instantly share code, notes, and snippets.

View arenadoon's full-sized avatar
✏️

Arena Artoon arenadoon

✏️
  • 03:44 (UTC +07:00)
View GitHub Profile
@robwent
robwent / functions.php
Created April 17, 2019 19:16
Remove Yoast HTML Comments “This site is optimized with the Yoast WordPress SEO plugin” with Yoast v11
//Remove Yoast HTML Comments
//https://gist.github.com/robwent/f36e97fdd648a40775379a86bd97b332
function go_yoast() {
if (defined('WPSEO_VERSION')){
add_action('get_header',function (){ ob_start(function ($o){
return preg_replace('/\n?<.*?Yoast SEO plugin.*?>/mi','',$o); }); });
add_action('wp_head',function (){ ob_end_flush(); }, 999);
}
}
@rkjha
rkjha / nginx-passenger-ssl.conf
Last active March 25, 2021 15:47
Nginx/Passenger config when using SSL with a Ruby/Rails Application.
# for redirecting hhtp traffic to https version of the site
server {
listen 80;
server_name example.com;
return 301 https://$server_name$request_uri;
}
# for redirecting to non-www version of the site
server {
listen 80;
@akshay-sihag
akshay-sihag / primary_category_shortcode.php
Created January 14, 2020 21:04
Display Primary Category (Yoast's WordPress SEO) with the help of a shortcode
// Creating Shortcode to display Yoast SEO Primary Category
// Add Shortcode
function get_yoast_primary_cat() {
$category = get_the_category();
$useCatLink = true;
// If post has a category assigned.
if ($category){
$category_display = '';
<?php
/* Mini Gavatar Cache */
/* 注:该程序中部分代码是WordPress所用,小幅修改即可复用。 */
function my_avatar( $email, $size = '50', $default = '', $alt = false ) {
$alt = (false === $alt) ? '' : esc_attr( $alt );
$f = md5( strtolower( $email ) );
$w = home_url(); //$w = get_bloginfo('url');
$a = $w. '/avatar/'. $f . '.jpg';
$e = preg_replace('/wordpress\//', '', ABSPATH) . 'avatar/' . $f . '.jpg';
$t = 604800; //设定7天, 单位:秒
@vaidik
vaidik / youtube-dl-mp3
Created February 11, 2012 05:45
Script that makes use of youtube-dl and ffmpeg to cleanly extract mp3 out of Youtube videos.
# Get/download youtube-dl from http://rg3.github.com/youtube-dl/
# Make it executable (chmod +x <path-to-youtube-dl>/youtube-dl)
# Copy it to /usr/bin to use it like a command (sudo cp <path-to-youtube-dl>/youtube-dl /usr/bin)
# Open your favourite editor and copy this script and save by any name you like (I use youtube-dl-mp3).
# Make it executable (chmod +x <path-to-youtube-dl-mp3>/youtube-dl-mp3)
# Copy it to /usr/bin to use it like a command (sudo cp <path-to-youtube-dl-mp3>/youtube-dl-mp3 /usr/bin)
# Done! :)
# Usage: youtube-dl-mp3 "http://www.youtube.com/watch?v=YnA6ExlxNJU&feature=fvst"
if [ -w "." ]
@ifduyue
ifduyue / install-proxychains-ng.sh
Last active November 5, 2021 06:50
Install proxychains-ng on CentOS
#!/bin/sh
# Usage:
# wget -O- https://gist.githubusercontent.com/ifduyue/dea03b4e139c5758ca114770027cf65c/raw/install-proxychains-ng.sh | sudo bash -s
set -eu
version=4.14
wget https://github.com/rofl0r/proxychains-ng/archive/v$version.tar.gz
tar xf v$version.tar.gz
@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;
@ahmedkaludi
ahmedkaludi / WordPress Loop with Google Structured Data.php
Created June 12, 2016 10:53
WordPress Loop with Google Structured Data
<?php
// checks if there are any posts that match the query
if ( have_posts() ) :
// If there are posts matching the query then start the loop
while ( have_posts() ) : the_post(); ?>
<article id="post-<?php the_ID(); ?>" role="article" itemprop="hasPart" itemscope="" itemtype="http://schema.org/Article">
<meta itemscope='itemscope' itemprop='mainEntityOfPage' itemType='https://schema.org/WebPage'/>
@ankitmundada
ankitmundada / download_gdrive
Last active April 17, 2022 23:11
Shell Script to download Publicly shared Google drive files
#!/bin/bash
# Get files from Google Drive
# Source: https://stackoverflow.com/a/50573452/2382312
# Usage: download_gdrive FILE_ID DESTINATION_PATH
# $1 = file ID
# $2 = file name
URL="https://drive.google.com/uc?export=download&id=$1"
@2xyo
2xyo / Readme.md
Created October 7, 2013 12:40
Kernel sysctl configuration file for Linux dedicated server systems at high-speed networks with loads of RAM and bandwidth available.

Sysctl-IP-Tunning

Kernel sysctl configuration file for Linux dedicated server systems at high-speed networks with loads of RAM and bandwidth available.

Installation

This file should be saved as /etc/sysctl.d/sysctl.local.conf and can be activated using the command: sysctl -e -p /etc/sysctl.d/*