Skip to content

Instantly share code, notes, and snippets.

@melice
melice / install_nginx.sh
Last active July 15, 2016 08:18
nginx 预编译版本安装脚本 ubuntu 14.04
#/bin/bash
#########################################
#Function: install_nginx
#Usage: bash install_nginx.sh
#Author: melice
#Version: 1.0
#########################################
wget http://nginx.org/keys/nginx_signing.key
sudo apt-key add nginx_signing.key
@melice
melice / auto_iptables.sh
Last active August 29, 2015 14:14
配置iptables脚本
#!/bin/bash
#########################################
#Function: auto_iptables
#Usage: bash auto_iptables.sh
#Author: melice
#Version: 1.0
#Origin: vpser.net
# for ubuntu only
#########################################
unit ListviewHelper;
interface
uses System.SysUtils, Vcl.ComCtrls;
type
TListviewHelper = class helper for TListview
public
procedure SetRowCount(Count: Integer; Compacted: Boolean = False);
<?php
$handle = fopen("http://www.youseeme.com/bi/m/api/save/todata3.json", "rb");
$result = stream_get_contents($handle);
fclose($handle);
$data = json_decode($result, true);
$keys = array_keys($data[0]);
echo '<table class="dataintable">';
echo "<tr>";
foreach ($keys as $k)
{
@melice
melice / playstream.pas
Created November 11, 2015 04:09
play a stream media
uses
iOSapi.Foundation, iOSapi.MediaPlayer, FMX.Platform.iOS;
Type
TForm1 = Class( TForm )
Procedure FormCreate( Sender: TObject );
Private
#!/etc/bash
wget -q -O - http://pkg.jenkins.io/debian/jenkins.io.key | sudo apt-key add -
echo "deb http://pkg.jenkins.io/debian binary/" | sudo tee -a /etc/apt/sources.list.d/jenkins.list
sudo apt-get update
sudo apt-get install -y jenkins
#!/etc/bash
#jenkins.stable.sh
wget -q -O - http://pkg.jenkins.io/debian-stable/jenkins.io.key | sudo apt-key add -
echo "deb http://pkg.jenkins.io/debian-stable binary/" | sudo tee -a /etc/apt/sources.list.d/jenkins.list
sudo apt-get update
sudo apt-get install -y jenkins
@melice
melice / loadNprepare.php
Created August 12, 2016 07:50
php file_get_contents loadHTML 乱码
function loadNprepare($url,$encod='') {
$content = file_get_contents($url);
if (!empty($content)) {
if (empty($encod))
$encod = mb_detect_encoding($content);
$headpos = mb_strpos($content,'<head>');
if (FALSE=== $headpos)
$headpos= mb_strpos($content,'<HEAD>');
if (FALSE!== $headpos) {
$headpos+=6;
@melice
melice / youtube.php
Last active August 17, 2016 08:35
fetch youtube channel as RSS
<?php
// origin : https://gist.github.com/Skalman/801436d9693ff03bc4ce
if (!isset($_GET['url'])) {
?>
<!DOCTYPE html>
<meta charset="utf-8">
<title>Youtube RSS creator</title>
<form>
<p>Create an RSS feed for the videos on the following page:
@melice
melice / getQueryString.js
Last active October 29, 2016 08:50
getQueryString
function getQueryString(name) {
location.href.replace("#", "");
// 如果链接没有参数,或者链接中不存在我们要获取的参数,直接返回空
if (location.href.indexOf("?") == -1 || location.href.indexOf(name + '=') == -1) {
return '';
}
// 获取链接中参数部分
var queryString = location.href.substring(location.href.indexOf("?") + 1);
// 分离参数对 ?key=value&key2=value2
var parameters = queryString.split("&");