Skip to content

Instantly share code, notes, and snippets.

@melice
melice / IsWin64.pas
Created May 14, 2012 09:27
check if is windows 64bit
function IsWin64: Boolean;
var
Kernel32Handle : THandle;
IsWow64Process : function(Handle: Windows.THandle; var Res: Windows.BOOL): Windows.BOOL; stdcall;
GetNativeSystemInfo : procedure(var lpSystemInfo: TSystemInfo); stdcall;
isWoW64 : Bool;
SystemInfo : TSystemInfo;
const
PROCESSOR_ARCHITECTURE_AMD64 = 9;
PROCESSOR_ARCHITECTURE_IA64 = 6;
<?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)
{
#!/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 / 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 / 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("&");
@melice
melice / mobilepage.js
Last active November 23, 2016 08:38
mobile auto jump js
<script>
(function(a,b){if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kw
@melice
melice / word2pdf.pas
Created October 16, 2017 14:04
office word docx save to pdf
program word2pdf;
{$APPTYPE CONSOLE}
{$R *.res}
uses
System.SysUtils,
System.Variants,
System.Win.ComObj,
Word2000,
Vcl.OleServer;
const