Skip to content

Instantly share code, notes, and snippets.

@legale
legale / wg-quick.sh
Last active February 19, 2022 07:43
wg-quick without bin/bash busybox /bin/sh is enough
#!/bin/sh
#set -x
WG_CONFIG=""
INTERFACE=""
ADDRESSES=""
MTU=""
DNS=""
DNS_SEARCH=""
TABLE=""
@legale
legale / Yatrie.php
Created August 1, 2018 10:40
Trie PHP Library
<?php
/**
* Class Yatrie
*/
class Yatrie
{
public $deal = []; //deallocated memory array to store deallocated memory blocks for the future reuse
/**
@legale
legale / longest-common-substring.php
Last active November 19, 2018 02:36 — forked from relaxnow/longest-common-substring.php
Longest Common Substring algorithm in PHP
<?php
function getLongestCommonSubstring($first, $second)
{
$longestCommonSubstringIndexInFirst = 0;
$table = array();
$largestFound = 0;
$firstLength = strlen($first);
$secondLength = strlen($second);
@legale
legale / uri.js
Last active January 12, 2018 20:06 — forked from jlong/uri.js
php parse_url() JS analog
function parse_url(uri){
var a = document.createElement('a');
a.href = uri;
return {scheme: a.protocol, user: a.username, pass: a.password,
host: a.hostname, port: a.port, path: a.pathname,
query: a.search, fragment: a.hash
}
}
//demo