Skip to content

Instantly share code, notes, and snippets.

🏠
Working from home

Lex Tang lexrus

🏠
Working from home
Block or report user

Report or block lexrus

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@lexrus
lexrus / createml.swift
Created Jun 29, 2018
CreateML 双色球
View createml.swift
import Cocoa
import CreateML
let 双色球神算子 = try MLTextClassifier(trainingData: [
"中奖啦": [
"09 11 14 20 27 30 09",
"02 09 14 15 16 23 10",
"11 16 19 22 25 30 08",
"02 05 06 13 16 19 03",
"04 09 15 16 19 27 10",
View CandleChart.swift
import UIKit
import PlaygroundSupport
let chartData: [Double] = [1, 2, 4, 0, 0, 2, 6, 0, 4, 8, 12, 14, 1, 2, 2, 0, 0, 1, 6, 0, 4, 0, 3, 0]
class TimelineCandleChart: UIView {
var data: [Double] = [] {
didSet { setNeedsDisplay() }
}
@lexrus
lexrus / RxTextFieldDelegateProxy.swift
Created Feb 14, 2018
RxSwift extension for textFieldShouldReturn of UITextFieldDelegate
View RxTextFieldDelegateProxy.swift
//
// RxTextFieldDelegateProxy.swift
//
// Created by Lex Tang on 2/14/18.
// Copyright © 2018 Krunoslav Zaher. All rights reserved.
//
import RxSwift
import RxCocoa
@lexrus
lexrus / config.txt
Last active Dec 26, 2017
xmr config
View config.txt
"pool_list" :
[
{"pool_address" : "monerohash.com:5555", "wallet_address" : "48m3umQuRFHg1gFn7gucmuCkJLjHYq3QhjLB9i9XwWtoJfRpCiuxeW2UxAVXfvAGvJNa5opPKjQJock61uc2GY2i3YBszHc", "pool_password" : "", "use_nicehash" : false, "use_tls" : false, "tls_fingerprint" : "", "pool_weight" : 1 },
],
"currency" : "monero",
"call_timeout" : 10,
"retry_time" : 30,
"giveup_limit" : 0,
"verbose_level" : 3,
"print_motd" : true,
@lexrus
lexrus / update_settings_version.sh
Created Aug 10, 2017
Update version string in Settings.bundle
View update_settings_version.sh
#!/bin/bash
PLISTBUDDY="/usr/libexec/PlistBuddy"
INFO_PLIST="$CODESIGNING_FOLDER_PATH/Info.plist"
SETTINGS_PLIST="$CODESIGNING_FOLDER_PATH/Settings.bundle/Root.plist"
VERSION_NUMBER="`$PLISTBUDDY -c \"Print CFBundleShortVersionString\" \"$INFO_PLIST\"`"
BUILD_NUMBER="`$PLISTBUDDY -c \"Print CFBundleVersion\" \"$INFO_PLIST\"`"
VERSION="Version $VERSION_NUMBER ($BUILD_NUMBER)"
GROUP_INDEX="`xmllint --xpath \"count(//array/dict)-1\" \"$SETTINGS_PLIST\"`"
$PLISTBUDDY -c "Set :PreferenceSpecifiers:$GROUP_INDEX:Title '$VERSION'" "$SETTINGS_PLIST"
@lexrus
lexrus / CollectionOperator.swift
Created Apr 24, 2017
Avoid hard-coded KVC collection operators
View CollectionOperator.swift
import Foundation
enum CollectionOperator: String {
case avg
case count
case max
case min
case sum
@lexrus
lexrus / enable-von-forward-nat.sh
Created Jun 15, 2016
Enable VPN forward for OpenVPN on Mac OS X El Capitan
View enable-von-forward-nat.sh
#
# https://roelant.net/2015/share-your-vpn-mac-el-capitan.html
sleep 15
#
/usr/sbin/sysctl -w net.inet.ip.fw.enable=1
/usr/sbin/sysctl -w net.inet.ip.forwarding=1
/usr/sbin/sysctl -w net.inet6.ip6.forwarding=1
pfctl -d
pfctl -f /Users/lex/Dropbox/openvpn/pf.conf -e
@lexrus
lexrus / enable_disqus_for_ghost_casper_theme.html
Created May 26, 2016
Inject Disqus comment script into Casper of Ghost blog. Append the following code in Settings -> Code Injection -> Blog Footer.
View enable_disqus_for_ghost_casper_theme.html
<script>
(function(disqusid) {
var d=document,sections=document.getElementsByTagName("section")
for(var i=0;i<sections.length;i++){
if(sections[i].className=='share'){
var div=d.createElement('div');
div.setAttribute('id','disqus_thread');
sections[i].parentNode.appendChild(div);
var s=d.createElement('script');
s.src='//'+disqusid+'.disqus.com/embed.js';
@lexrus
lexrus / BackgroundHint.m
Created May 11, 2016
iOS task list hint
View BackgroundHint.m
//
// BackgroundHint.m
// Zus
//
// Created by Lex on 4/13/16.
// Copyright © 2016 lex.sh. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
@lexrus
lexrus / dnspod-ddns.py
Last active Apr 16, 2016 — forked from likebeta/dnspod-ddns.py
ddns power by dnspod api
View dnspod-ddns.py
#!/usr/bin/env python
# -*- coding=utf-8 -*-
# Author: 易思龙 <ixxoo.me@gmail.com>
# Create: 2015-09-05
import time
import json
import urllib
import urllib2
You can’t perform that action at this time.