Skip to content

Instantly share code, notes, and snippets.

View vibbow's full-sized avatar
🏠
Working from home

vibbow

🏠
Working from home
View GitHub Profile
@vibbow
vibbow / AutoRT.php
Last active August 29, 2015 13:56
自动RT指定Twitter用户的所有Tweet。
<?php
set_time_limit(300);
mb_internal_encoding("UTF-8");
header('Content-Type: text/html; charset=utf-8');
define('APP_DIR', __DIR__ . DIRECTORY_SEPARATOR);
define('TWIP_URL', 'TWIP O 模式地址'); // TWIP O 模式地址,实在懒得去处理OAuth的东西了
define('TWITTER_ID', 'Twitter User ID'); // Twitter 用户的 ID,防止用户改名
define('ADD_STR', '#土豪 的日常 RT @[USERNAME] '); // 要附加在原始推文前的内容
@vibbow
vibbow / fix_permission.php
Created April 21, 2014 00:12
Ubuntu /var/www 目录权限修复脚本
<?php
$path = '/var/www';
`chown -R www-data:www-data {$path}`;
`chown root:root {$path}`;
mod_dir($path);
function mod_dir($path) {
$files = scandir($path);
@vibbow
vibbow / 2-waysms.php
Created April 23, 2014 18:49
2-WaySMS 调用脚本
<?php
define('SMS_NUMBER', '');
define('SMS_TOKEN', '');
define('SMS_API', 'http://www.2-waysms.com/my/api/sms.php');
$to = '';
$message = '';
$senderid = '';
echo sendsms($to, $message, $senderid);
@vibbow
vibbow / route_bat_generator.php
Created May 23, 2014 21:44
Windows 路由表添加脚本生成工具
<?php
/**
* Windows 路由添加脚本生成工具
* 由路由列表文件,生成Windows适用的路由添加脚本
* vibbow @ 2014/5/23
*
* 参考路由列表文件:
* http://www.dnspod.cn/misc/iplist.txt
* 可从中截取出要生成的运营商路由表
@vibbow
vibbow / tplink-ip.php
Created January 22, 2014 22:40
从TP-Link管理页面抓取外网IP的脚本
@vibbow
vibbow / ntp-client.php
Created January 22, 2014 23:55
PHP通过NTP服务器获取时间脚本
#!/usr/bin/php -q
<?php
echo "PHP Time Protocol Client\n";
echo "-----------------\n";
/* NTP服务器列表 */
$ntp_server_list = array(
'0.hk.pool.ntp.org',
'0.asia.pool.ntp.org',
'1.asia.pool.ntp.org',
@vibbow
vibbow / uptime.php
Created January 23, 2014 00:01
优雅 (蛋疼) 的获取Linux开机时长
<?php
$uptime = file_get_contents('/proc/uptime'); // 1164820.24 4655047.46;
$upsecond = (int)explode(' ', $uptime)[0];
$datediff = date_diff(date_create(), date_create("{$upsecond} second ago"), true);
echo $datediff->y . "\r\n";
echo $datediff->m . "\r\n";
echo $datediff->d . "\r\n";
echo $datediff->h . "\r\n";
echo $datediff->i . "\r\n";
<?php
define ('DB_SOURCE', 'd:\\leakdb');
define ('CACHE_LIMIT', 67108864);
define ('RESULT_LIMIT', 1000);
define ('TIME_LIMIT', 600);
$begin = microtime(true);
set_time_limit(TIME_LIMIT + 100);
ob_end_flush();
$all_app = Get-AppxPackage
foreach ($each_app in $all_app)
{
$each_family_name = $each_app.PackageFamilyName
$each_capability = (Get-AppxPackageManifest $each_app).Package.Capabilities.Capability
if ($each_capability)
{
if ($each_capability.Name.Contains('internetClient') -or $each_capability.Name.Contains('internetClientServer'))
<?php
$fileUrl = 'http://repo.packagist.org/packages.json';
$options = array (
'http' =>
array (
'follow_location' => 0,
'max_redirects' => 20,
'proxy' => 'tcp://127.0.0.1:8888',