Skip to content

Instantly share code, notes, and snippets.

View arenadoon's full-sized avatar
✏️

Arena Artoon arenadoon

✏️
  • 01:29 (UTC +07:00)
View GitHub Profile
@ssbarnea
ssbarnea / mysql-convert-utf8.py
Created July 6, 2011 18:48
Script to convert a a database to use utf8 encoding
#! /usr/bin/env python
import MySQLdb
host = "localhost"
passwd = ""
user = "root"
dbname = "mydbname"
db = MySQLdb.connect(host=host, user=user, passwd=passwd, db=dbname)
cursor = db.cursor()
@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;
@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 "." ]
@codler
codler / gist:3906826
Created October 17, 2012 17:18
Support HTTP Header Range, mp4, php.php/mp4.mp4
<?php
# Nginx don't have PATH_INFO
if (!isset($_SERVER['PATH_INFO'])) {
$_SERVER['PATH_INFO'] = substr($_SERVER["ORIG_SCRIPT_FILENAME"], strlen($_SERVER["SCRIPT_FILENAME"]));
}
$request = substr($_SERVER['PATH_INFO'], 1);
$file = $request;
$fp = @fopen($file, 'rb');
@Steven-Rose
Steven-Rose / gist:3943830
Created October 24, 2012 04:27
VI: Select all + delete, select all + copy
Select all and delete (actually move to buffer)
:%d
Select all and copy to buffer
:%y
Use p to paste the buffer.
@kgriffs
kgriffs / sysctl.conf
Last active March 21, 2025 04:08
Linux Web Server Kernel Tuning
# Configuration file for runtime kernel parameters.
# See sysctl.conf(5) for more information.
# See also http://www.nateware.com/linux-network-tuning-for-2013.html for
# an explanation about some of these parameters, and instructions for
# a few other tweaks outside this file.
#
# See also: https://gist.github.com/kgriffs/4027835
#
# Assumes a beefy machine with lots of network bandwidth
@eusonlito
eusonlito / foldersize.php
Last active March 11, 2025 07:56
PHP function to get the folder size including subfolders
<?php
function folderSize ($dir)
{
$size = 0;
foreach (glob(rtrim($dir, '/').'/*', GLOB_NOSORT) as $each) {
$size += is_file($each) ? filesize($each) : folderSize($each);
}
<?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天, 单位:秒
@rafaelbiriba
rafaelbiriba / install_ffmpeg_libfdkaac.sh
Last active July 25, 2024 03:04
Install FFmpeg with libfdk_aac support (For Ubuntu)
# Criando um script .sh para executar todos os comandos:
#root@servidor:~# vi script.sh
#root@servidor:~# chmod +x script.sh
#root@servidor:~# ./script.sh
apt-get update
apt-get -y install autoconf automake build-essential git-core libass-dev libgpac-dev libsdl1.2-dev libtheora-dev libtool libvdpau-dev libvorbis-dev libx11-dev libxext-dev libxfixes-dev pkg-config texi2html zlib1g-dev libmp3lame-dev nasm gcc yasm && true
mkdir ~/ffmpeg_sources
cd ~/ffmpeg_sources
git clone --depth 1 git://github.com/mstorsjo/fdk-aac.git
@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/*