Skip to content

Instantly share code, notes, and snippets.

@jamesBan
jamesBan / Activate Office 2019 for macOS VoL.md
Created June 18, 2022 02:58 — forked from zthxxx/Activate Office 2019 for macOS VoL.md
crack activate office on mac with license file

Activate MS Office 2019/2016 for macOS - Microsoft_Office_2019_VL_Serializer

Office 2019 above

2019-06-03

Note that Office2019 DO NOT support activate via simple copy/paste plist license file which is the simplest way to activate Office 2016. Fortunately, you can also use the VL Serializer tool, just install Office 2019 and Serializer, then run Serializer to activate.

Ref

@jamesBan
jamesBan / curl-resolve.php
Created August 10, 2021 10:00
指定域名对应ip请求
<?php
$data = [];
$ch = curl_init();
curl_setopt($ch, CURLOPT_RESOLVE, ['api.example.com:80:127.0.0.1']);
curl_setopt($ch, CURLOPT_PORT, 80);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HEADER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
@jamesBan
jamesBan / check-ssl-expire.php
Created June 25, 2021 08:56
检查证书过期
<?php
function getSslExpireTime(string $url): int
{
if(!filter_var($url, FILTER_VALIDATE_URL)) {
throw new \RuntimeException('invalidate url:'.$url);
}
$domain = parse_url($url, PHP_URL_HOST);
$context = stream_context_create([
"ssl" => ["capture_peer_cert" => true]
@jamesBan
jamesBan / go-context-cancel.go
Created June 19, 2021 03:08
context timeout routine泄漏问题
package main
import (
"fmt"
"golang.org/x/net/context"
"log"
"math/rand"
"runtime"
"time"
)
@jamesBan
jamesBan / main.go
Created June 19, 2021 02:59
分批执行
package main
import (
"fmt"
"sync"
"time"
)
const num = 10
func main() {
<?php
/**
* @return Generator
*/
function fib()
{
[$a, $b] = [0, 1];
while (true) {
yield $b;
[$a, $b] = [$b, $a + $b];
@jamesBan
jamesBan / string2stream.php
Created September 24, 2020 03:46
string to stream
<?php
$string = "I tried, honestly!";
$stream = fopen('data://text/plain,' . $string,'r');
echo stream_get_contents($stream);
$string = 'Some bad-ass string';
$stream = fopen('php://memory','r+');
@jamesBan
jamesBan / File.php
Created August 20, 2020 06:51
切割、合并文件
<?php
/**
* Class File
* @package app\commands
*/
class File
{
/**
* @param string $filename
@jamesBan
jamesBan / mac_ipv6.sh
Created June 24, 2020 11:53
打开或关闭mac 的ipv6功能
关闭系统的 IPV6 功能。
OS X 下关闭方法:
networksetup -setv6off Wi-Fi
networksetup -setv6off Ethernet(如果电脑有以太网接口)
开启方法:
networksetup -setv6automatic Wi-Fi
networksetup -setv6automatic Ethernet(如果电脑有以太网接口)
@jamesBan
jamesBan / mac_switch_wifi.sh
Created February 19, 2020 01:10
mac切换wifi
#!/bin/bash
switch office wifi
networksetup -setairportnetwork en0 wifi网络名
if [ $? -ne 0 ]; then
echo "swtich office network fail"
exit
fi
leep 2
echo "switch office wifi success";