Skip to content

Instantly share code, notes, and snippets.

View liruqi's full-sized avatar

Ruqi liruqi

View GitHub Profile
@kyo-takano
kyo-takano / lexical_search_with_gzip.py
Last active March 11, 2024 03:39
Lexical Search with gzip (gzipによる語彙検索)
import gzip
def gzip_search(query: str, candidate_chunks: list[str], top_k: int=1):
"""
文字列ベースで類似したテキストチャンクを推定するアルゴリズム.
`query`, `chunk`, および`query + " " + chunk`をそれぞれgzipで圧縮し、編集距離のようなものをベースに評価する.
Parameters:
query (str): 検索クエリとして使用する文字列.
top_k (int, optional): 返される類似チャンクの上位k個を指定する (default: 1).

Aligning images

This is a guide for aligning images.

See the full Advanced Markdown doc for more tips and tricks

left alignment

@wavezhang
wavezhang / java_download.sh
Last active April 26, 2024 10:36
download java from oracle without login
wget -c --no-cookies --no-check-certificate --header "Cookie: oraclelicense=accept-securebackup-cookie" https://download.oracle.com/otn-pub/java/jdk/12.0.2+10/e482c34c86bd4bf8b56c0b35558996b9/jdk-12.0.2_linux-x64_bin.tar.gz
/*
* Copyright (c) 2010 Apple Inc. All rights reserved.
*/
function characterNeedsScoreMultiplier(e) {
if (!e || e.length === 0)
return !1;
var t = e.charCodeAt(0);
return t > 11904 && t < 12031?!0 : t > 12352 && t < 12543?!0 : t > 12736 && t < 19903?!0 : t > 19968 && t < 40959?!0 : t > 44032 && t < 55215?!0 : t > 63744 && t < 64255?!0 : t > 65072 && t < 65103?!0 : t > 131072 && t < 173791?!0 : t > 194560 && t < 195103?!0 : !1
}
function domDistance(e, t, n) {
@creaoy
creaoy / extract-testflight.js
Created November 30, 2015 21:11 — forked from larsparendt/extract-testflight.js
Extract TestFlight user email addresses from iTunes Connect
//Make sure you scroll down to get all data loaded
var text = '';
$('.col-email').each(function(index,el) {
if (index == 0) {
text = 'Email, First Name, Last Name\n';
}
else {
//Email
text = text + $.trim($(el).find("a").text()) + ',';
//First Name
@sunnyxx
sunnyxx / attribute_overloadable_test.md
Last active July 18, 2018 04:59
__attribute__((overloadable)) test
__attribute__((overloadable)) NSString *descriptionFromValue(float value) {
    return @(value).stringValue;
}
__attribute__((overloadable)) NSString *descriptionFromValue(NSRange range) {
    return NSStringFromRange(range);
}
__attribute__((overloadable)) NSString *descriptionFromValue(id object) {
    return [object description];
}

First of all, this is not my brilliant effort to get react-native working on Windows, it is the collation of work by others, particularly @mqli and @Bernd Wessels. I've just summarised what worked for me.

If you would prefer to read what I've plagerised, head over to mqli's great gist

Disclaimer

  • The below is tested with react-native-cli 0.1.5, react-native 0.12.0 on Windows 10, node 4.1.1, and Android (physical Nexus 6 and AVD with API v22)
  • I hope this will all be redundant in a few weeks. Please comment on stuff that is now fixed and I will update this to keep it relevant.
  • Sprinkle a bit of YMMV around

Keep this github issue handy, it’s the bucket for all Windows/Linux related tricks to get RN working.

@cloverstd
cloverstd / aliyun.sources.list
Last active August 31, 2016 05:03 — forked from taichunmin/aliyun.sources.list
阿里云 ubuntu 14.04 镜像
# deb http://mirrors.aliyun.com/ubuntu trusty main restricted
# deb http://mirrors.aliyuncs.com/ubuntu trusty main restricted
# deb http://mirrors.aliyun.com/ubuntu trusty-updates main restricted
# deb http://mirrors.aliyuncs.com/ubuntu trusty-updates main restricted
# deb http://security.ubuntu.com/ubuntu trusty-security main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://mirrors.aliyun.com/ubuntu trusty main restricted
@mattt
mattt / NSDecimalNumber.swift
Last active April 1, 2023 00:06
NSDecimalNumber Additions for Swift
import Foundation
// MARK: - Comparable
extension NSDecimalNumber: Comparable {}
public func ==(lhs: NSDecimalNumber, rhs: NSDecimalNumber) -> Bool {
return lhs.compare(rhs) == .OrderedSame
}
@klzgrad
klzgrad / Naive-VPN.md
Created November 17, 2014 00:43
朴素VPN:一个纯内核级静态隧道

朴素VPN:一个纯内核级静态隧道

由于路由管控系统的建立,实时动态黑洞路由已成为最有效的封锁手段,TCP连接重置和DNS污染成为次要手段,利用漏洞的穿墙方法已不再具有普遍意义。对此应对方法是多样化协议的VPN来抵抗识别。这里介绍一种太简单、有时很朴素的“穷人VPN”。

朴素VPN只需要一次内核配置(Linux内核),即可永久稳定运行,不需要任何用户态守护进程。所有流量转换和加密全部由内核完成,原生性能,开销几乎没有。静态配置,避免动态握手和参数协商产生指纹特征导致被识别。并且支持NAT,移动的内网用户可以使用此方法。支持广泛,基于L2TPv3标准,Linux内核3.2+都有支持,其他操作系统原则上也能支持。但有两个局限:需要root权限;一个隧道只支持一个用户。

朴素VPN利用UDP封装的静态L2TP隧道实现VPN,内核XFRM实现静态IPsec。实际上IP-in-IP隧道即可实现VPN,但是这种协议无法穿越NAT,因此必须利用UDP封装。内核3.18将支持Foo-over-UDP,在UDP里面直接封装IP,与静态的L2TP-over-UDP很类似。

创建一个朴素VPN