Skip to content

Instantly share code, notes, and snippets.

@fieldAbyss
fieldAbyss / settings.json
Last active April 28, 2019 06:55
VS code settings.json
{
"editor.fontSize": 14,
"editor.fontFamily": "Ricty Diminished",
"editor.renderWhitespace": "boundary",
"editor.minimap.enabled": true,
"editor.renderControlCharacters": false,
"editor.suggestSelection": "first",
"workbench.startupEditor": "newUntitledFile",
"workbench.colorTheme": "Slime",
"workbench.iconTheme": "material-icon-theme",
@fieldAbyss
fieldAbyss / ssl-params.conf
Created December 27, 2018 09:49
/etc/nginx/snippets/ssl-params.conf
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_prefer_server_ciphers on;
ssl_ciphers "EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH";
ssl_ecdh_curve secp384r1;
ssl_session_cache shared:SSL:60m;
ssl_session_tickets off;
ssl_stapling on;
ssl_stapling_verify on;
#ssl_session_timeout 5m;
@fieldAbyss
fieldAbyss / ssl-example.com.conf
Created December 27, 2018 09:49
Nginx + SSL /etc/nginx/snippets/ssl-example.com.conf
ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;
@fieldAbyss
fieldAbyss / IndentedLabel.swift
Created December 10, 2018 05:19
'UIEdgeInsetsInsetRect' has been replaced by instance method 'CGRect.inset(by:)'
class IndentedLabel: UILabel {
override func drawText(in rect: CGRect) {
let insets = UIEdgeInsets(top: 0, left: 16, bottom: 0, right: 0)
// let customRect = UIEdgeInsetsInsetRect(rect, insets) Swift 4.0
// Swift 4.2~
let customRect = rect.inset(by: insets)
super.drawText(in: customRect)
}
@fieldAbyss
fieldAbyss / Example.swift
Last active March 15, 2019 12:59
'UIImageJPEGRepresentation' has been replaced by instance method 'UIImage.jpegData(compressionQuality:)'
// Old Swift ~4.0
let imageData = UIImageJPEGRepresentation(image, 0.8)
// New Swift 4.2~
let imageData = image.jpegData(compressionQuality: 0.8)
import numpy as np
import pandas as pd
# ADX
def adx_di(high, low, close, period_di, period_adx):
last_close = shift(close, 1, cval=0)
last_high = shift(high, 1, cval=0)
last_low = shift(low, 1, cval=0)
dmp = np.where((high - last_high) < 0, 0, (high - last_high))
# RCI
ord(seq, idx, itv) =>
p = seq[idx]
o = 1
for i = 0 to itv - 1
if p < seq[i]
o := o + 1
o
d(itv) =>
# RCI
def RCI(seq, itv):
def ord(seq, idx, itv):
p = seq[idx]
o = 1
for i in range(itv - 1):
if p < seq[i]:
o += 1
return o
import pandas as pd
period = 14
# pandas 0.23.4
df_close.rolling(period).max()
df_close.rolling(period).min()
df_close.rolling(period).mean()
df_close.rolling(period).std()
@fieldAbyss
fieldAbyss / example.com
Last active December 28, 2018 05:58
Nginx + SSL + Laravel /etc/nginx/sites-available/example.com
server {
listen 80;
listen [::]:80;
server_name example.com;
return 301 https://$server_name$request_uri;
}
server {
listen 443 ssl http2;