Skip to content

Instantly share code, notes, and snippets.

View Rivsen's full-sized avatar
🎯
Learning how to play~

Rivsen Tan Rivsen

🎯
Learning how to play~
View GitHub Profile
@m13253
m13253 / sysctl.conf
Last active August 29, 2015 13:59
TCP tuning for high latency network in sysctl.conf -- http://hong.im/2013/04/20/linux-tcp-tuning/
# http://hong.im/2013/04/20/linux-tcp-tuning/
net.ipv4.tcp_syncookies = 1
# 表示开启 SYN Cookies。当出现 SYN 等待队列溢出时,启用 cookies 来处理,可防范少量 SYN 攻击,默认为 0,表示关闭;
net.ipv4.tcp_tw_reuse = 1
# 表示开启重用。允许将 TIME-WAIT sockets 重新用于新的 TCP 连接,默认为 0,表示关闭;
net.ipv4.tcp_tw_recycle = 1
# 表示开启 TCP 连接中 TIME-WAIT sockets 的快速回收,默认为 0,表示关闭;
net.ipv4.tcp_fin_timeout = 15
# 修改系統默认的 TIMEOUT 时间。
@Rivsen
Rivsen / routes.php
Created September 22, 2015 12:03
a php internat server route file for flarum
<?php
// Set timezone
// date_default_timezone_set("UTC");
// Directory that contains error pages
define("ERRORS", dirname(__FILE__) . "/flarum/error");
// Default index files
define("WEB_INDEX", "index.php");
define("API_INDEX", "api.php");

OpenStack

In this document I describe the steps to setup OpenStack cloud on Fedora 19

Setup

First, install OpenStack on Fedora 19

RDO Quick Start -

@Rivsen
Rivsen / .gitignore
Last active September 13, 2016 03:45
使用Symfony2的EventDispatcher组件创建自定义Event逻辑
composer.lock
vendor/
*.bak
*.swp
*.swap
*.old
*.back
.DS_Store
@kmark
kmark / findLowQualitySongs.php
Last active January 20, 2017 08:22
Finds low quality songs in a directory based on a minimum bit rate. Tested with PHP 5.5.4. Find MediaInfo at mediaarea.net. I don't rely on MediaInfo for the recursion because it uses a fuckton of memory trying to do it.
<?php
/*******************************************************************************
* Copyright 2013 Kevin Mark *
* *
* Licensed under the Apache License, Version 2.0 (the "License"); *
* you may not use this file except in compliance with the License. *
* You may obtain a copy of the License at *
* *
* http://www.apache.org/licenses/LICENSE-2.0 *
* *
@Rivsen
Rivsen / play.rs
Created January 20, 2017 14:07
play.rs
use std::iter::FromIterator;
fn main() {
let columns_number: i64 = 356;
println!("Number of columns_number: {}", columns_number);
let mut columns_array: Vec<String> = Vec::new();
let mut last_column: Vec<char> = Vec::new();
@valentin2105
valentin2105 / docker-compose.yml
Created April 11, 2016 10:58
docker-compose.yml LEMP PHP7.0
web_db:
image: mariadb:latest
restart: always
volumes:
- ./var/mysql:/var/lib/mysql
environment:
MYSQL_ROOT_PASSWORD: @Str0NgP@Ssw0rd
web_front:
image: nginx
@dariodiaz
dariodiaz / 0) ABC for Sendy with Laravel
Created January 21, 2014 17:17 — forked from jasonlemay/0) ABC for Sendy with Laravel
laravel: send emails with sendy
Setting up Sendy with Laravel
(there might be bugs, I striped out some parts of my code because what I have is more complicated then that, so, sorry if it's broken!)
--
I would recommand creating a database for Sendy only.
Add Sendy's database into your database.php (1)
Create the Campaign model (2), and specify that you want to use Sendy's database (Campaigns are the only thing we really need to create, other things like creating lists can be done through Sendy interface, and there is a PHP library to add subscribers)
Now, it's time to install Sendy, usually somewhere like yourapp.com/sendy or yourapp.com/newsletter
<?php
class DefaultController extends Controller
{
/**
* Dashboard page.
* @Permissions(perm="dashboard_view")
* @Route("/", name="ITEDashboardBundle_index")
* @Template()
* @return array
@umidjons
umidjons / startswith-endswith.md
Created April 8, 2014 05:40
PHP: startsWith & endsWith functions

startsWith & endsWith functions

<?php
function startsWith($haystack, $needle)
{
    return strncmp($haystack, $needle, strlen($needle)) === 0;
}

function endsWith($haystack, $needle)