Skip to content

Instantly share code, notes, and snippets.

http://paste.ubuntu.com/23654022/
Office手动激活命令:
cd C:\Program Files\Microsoft Office\Office15
cscript ospp.vbs /sethst:192.168.123.1
cscript ospp.vbs /act
cscript ospp.vbs /dstatus
windows手动激活命令
@Weeker
Weeker / py-kms.sh
Created May 8, 2014 13:43
Emulated KMS Servers on non-Windows platforms
#!/bin/sh
### BEGIN INIT INFO
# Provides: KMS v6 emulator
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: $network
# Should-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Description: Emulated KMS Servers on non-Windows platforms
@liunian
liunian / gist:9338301
Last active July 11, 2024 09:59
Human Readable File Size with PHP
<?php
# http://jeffreysambells.com/2012/10/25/human-readable-filesize-php
function human_filesize($bytes, $decimals = 2) {
$size = array('B','kB','MB','GB','TB','PB','EB','ZB','YB');
$factor = floor((strlen($bytes) - 1) / 3);
return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$size[$factor];
}
echo human_filesize(filesize('example.zip'));
@xeoncross
xeoncross / fingerprint.php
Last active August 12, 2020 23:37
Generate a fingerprint from and RSA SSH public key
<?php
print "\n";
$rsa = file_get_contents('rsa.pub');
$ssh = file_get_contents('ssh.pub');
// For reference
print $rsa . "\n\n";
print $ssh . "\n\n";
@danpoltawski
danpoltawski / gist:5081032
Created March 4, 2013 09:19
sql query including bank holidays
SELECT t.trip_id, s.departure_time, t.trip_headsign
FROM gtfs_stop_times s
JOIN gtfs_trips t ON s.trip_id = t.trip_id
WHERE s.stop_id = 99005 AND s.departure_time >= "17:10:53"
AND s.danp_last_stop IS NULL
AND t.service_id IN (SELECT c.service_id FROM gtfs_calendar c
LEFT JOIN gtfs_calendar_dates d ON d.service_id = c.service_id AND d.date = "20130304"
WHERE c.start_date <= "20130304" AND c.end_date >= "20130304" AND c.monday = 1 AND d.service_id IS NULL
UNION SELECT service_id FROM gtfs_calendar_dates d WHERE d.date = "20130304" AND d.exception_type = 1)
ORDER BY s.departure_time LIMIT 2;
@diorahman
diorahman / client.html
Created December 26, 2011 03:34
Ajax, call jQuery POST to node.js expressjs
<html>
<head>
<title>jsonp test</title>
<script src="http://code.jquery.com/jquery-1.6.2.min.js"></script>
<script type="text/javascript">
$(function(){
$('#select_link').click(function(e){
e.preventDefault();
console.log('select_link clicked');
@freretuc
freretuc / _sql.php
Last active November 28, 2018 20:44
MySQL / MariaDB PDO + functions
<?php
define('DB_HOST', 'localhost');
define('DB_USER', 'bla');
define('DB_PASS', 'bla');
define('DB_BASE', 'bla');
define('DB_CONN', 'mysql:host='.DB_HOST.';dbname='.DB_BASE);
// Buildin singleton class