Skip to content

Instantly share code, notes, and snippets.

View tearf001's full-sized avatar
🎯
Focusing

Tiffiny Jenis tearf001

🎯
Focusing
View GitHub Profile
@tearf001
tearf001 / plg2
Created April 1, 2018 16:40
hello world
import sublime, sublime_plugin
class ExampleCommand(sublime_plugin.TextCommand):
def run(self, edit):
self.view.insert(edit, 0, "Hello, World!")
@tearf001
tearf001 / sql
Created July 25, 2018 06:56
返回匿名表
CREATE FUNCTION extended_sales(p_itemno int)
RETURNS TABLE(quantity int, total numeric) AS $$
BEGIN
RETURN QUERY SELECT s.quantity, s.quantity * s.price FROM sales AS s
WHERE s.itemno = p_itemno;
END;
$$ LANGUAGE plpgsql;
--实战用例:
path-to-oracle-client\BIN\sqlldr userid=用户名/密码@tns名 control=控制文件.ctl direct=y parallel=y readsize=10005008 errors=999999999
--控制文件.ctl内容:
load data
CHARACTERSET 'UTF8'
infile "webdata20180724_wh.txt"
Append into table xw_tmp_to_liuling_20180725
fields terminated by ","
@tearf001
tearf001 / .sql
Last active July 25, 2018 16:37
动态查询引用三级
EXECUTE 'UPDATE tbl SET '
|| quote_ident(colname) --
|| ' = '
|| quote_nullable(newvalue)
|| ' WHERE key = '
|| quote_literal(keyvalue);
EXECUTE format('UPDATE tbl SET %I = %L '
'WHERE key = %L', colname, newvalue, keyvalue);
String supplant(String o,map) {
RegExp r = RegExp(r"{([^{}]+)}");
return o.replaceAllMapped(r,(match){
//print('matched;${match.group(1)}');
return '${map[match.group(1)]}';
});
}
main(){
print(supplant('hello,{person},i will {do} u',{'person':'julie','do':['love','then','touch']}));
}
String deversion(String version){
if(version == null || version.compareTo("1.0.0")<0) return version;
var versions = version.split('.');
var s = int.parse(versions.first) -1;
versions[0] = s.toString();
return versions.join('.');
}
int versionValue(String version){
if(version == null) return null;
var versions = version.split('.');
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
<script src=https://unpkg.com/@reactivex/rxjs@6.5.1/dist/global/rxjs.umd.js></script>
</head>
<body>
@tearf001
tearf001 / uri-api.dart
Last active July 18, 2019 12:23
uri-api
main() {
var p2 = '/Images/png/yw_icon.png';
var p3 = 'Images/png/yw_icon.png';
var rs = [
'http://61.183.0.23/gzzs/appstore.aspx?d=18',
'https://13.cn.123/root/',
'https://13.cn.123/api',
'ftp://123.23.132/',
'wx://123/23',
p2,
@tearf001
tearf001 / exception-future.dart
Created July 19, 2019 14:24
exception-future
import 'dart:async';
main() {
Future.value(10).then((_) {
Future(() => throw 'err').catchError((_){
print('innner $_');
throw 'no catch';
});
return _;
}).then((_) {
@tearf001
tearf001 / wsl2-network.ps1
Created February 1, 2021 09:28 — forked from daehahn/wsl2-network.ps1
WSL 2 TCP NETWORK FORWARDING
# WSL2 network port forwarding script v1
# for enable script, 'Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope CurrentUser' in Powershell,
# for delete exist rules and ports use 'delete' as parameter, for show ports use 'list' as parameter.
# written by Daehyuk Ahn, Aug-1-2020
# Display all portproxy information
If ($Args[0] -eq "list") {
netsh interface portproxy show v4tov4;
exit;
}