Function:
function shorten_text($text, $max_length = 140, $cut_off = '...', $keep_word = false)
{
if(strlen($text) <= $max_length) {
return $text;
}
if(strlen($text) > $max_length) {
user web; | |
# One worker process per CPU core. | |
worker_processes 8; | |
# Also set | |
# /etc/security/limits.conf | |
# web soft nofile 65535 | |
# web hard nofile 65535 | |
# /etc/default/nginx |
Function:
function shorten_text($text, $max_length = 140, $cut_off = '...', $keep_word = false)
{
if(strlen($text) <= $max_length) {
return $text;
}
if(strlen($text) > $max_length) {
This is a collection of working commandline examples to show how one could use FFMpeg and VLC for live transcoding of video streams. All examples have been tested on OSX 10.7.5 with FFMPeg 1.1.3 and VLC 2.0.5 in early 2013.
Documentation links
/* | |
* Gulp augmentation | |
*/ | |
function getTasks(){ | |
return gulp._registry._tasks; | |
} | |
function getTaskNamesInNamespace(namespace){ | |
var tasks = getTasks(); | |
var taskNames = Object.keys(tasks); |
#!/usr/bin/env bash | |
# Dépendance : screen, killall et rtorrent | |
### BEGIN INIT INFO | |
# Provides: <username>-rtorrent | |
# Required-Start: $syslog $network | |
# Required-Stop: $syslog $network | |
# Default-Start: 2 3 4 5 | |
# Default-Stop: 0 1 6 | |
# Short-Description: Start daemon at boot time |
#!/bin/bash | |
# | |
# Fix postgres after OSX crashed | |
pg_resetxlog /usr/local/var/postgres | |
rm /usr/local/var/postgres/postmaster.pid | |
pg_resetxlog /usr/local/var/postgres | |
pg_resetxlog -f /usr/local/var/postgres | |
pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start |
# | |
# | |
# The Seedbox From Scratch Script | |
# By Notos ---> https://github.com/Notos/ | |
# | |
# | |
###################################################################### | |
# | |
# Copyright (c) 2013 Notos (https://github.com/Notos/) | |
# |
error_page 500 /500.html; | |
location /500.html{ | |
return 500 '{"error": {"status_code": 500,"status": "Internal Server Error"}}'; | |
} | |
error_page 502 /502.html; | |
location /502.html{ | |
return 502 '{"error": {"status_code": 502,"status": "Bad Gateway"}}'; | |
} |
# Compiled source # | |
################### | |
*.com | |
*.class | |
*.dll | |
*.exe | |
*.o | |
*.so | |
# Packages # |
<?php | |
function array_keys_multi(array $array) | |
{ | |
$keys = array(); | |
foreach ($array as $key => $value) { | |
$keys[] = $key; | |
if (is_array($array[$key])) { | |
$keys = array_merge($keys, array_keys_multi($array[$key])); |