Skip to content

Instantly share code, notes, and snippets.

View chairco's full-sized avatar
🏠
Working from home

Jason chairco

🏠
Working from home
View GitHub Profile
@chairco
chairco / nodejs-ubuntu-bind-port-80.md
Created March 21, 2018 02:52 — forked from guifromrio/nodejs-ubuntu-bind-port-80.md
Allow Node.js to bind to privileged ports without root access on Ubuntu

How to: Allow Node to bind to port 80 without sudo

TL;DR

Only do this if you understand the consequences: all node programs will be able to bind on ports < 1024

sudo setcap 'cap_net_bind_service=+ep' /usr/local/bin/node

Important: your node location may vary. Use which node to find it, or use it directly in the command:

@chairco
chairco / binary.md
Last active November 21, 2023 13:21
Python 其淫技巧大整理
@chairco
chairco / Brackets.md
Created July 26, 2017 14:39
Codility-Stacks and Queues-Determine whether a given string of parentheses is properly nested

A string S consisting of N characters is considered to be properly nested if any of the following conditions is true:

S is empty; S has the form "(U)" or "[U]" or "{U}" where U is a properly nested string; S has the form "VW" where V and W are properly nested strings. For example, the string "{[()()]}" is properly nested but "([)()]" is not.

Write a function:

@chairco
chairco / luigi-tutorial.md
Last active August 23, 2022 10:01
luigi tutorial. 路以基教學,適合用在做機器學習時處理 data pipeline 的套件。Spotify 開源

#

簡述

Luigi 是一個用來處理資料流的框架,支援 hadoop, hdfs, mysql, postgresql 等儲存庫。他的特點就是可以設定 task 之間相依性。因此可以用來處理複雜的 pipeline 批次工作。

架構

Luigi 主要的框架由幾個組成:require(), run(), output() 所有的任務會繼承 luigi.Task 類別然後透過這三個 method 來控制想執行任務。

import luigi
@chairco
chairco / Spark-mac-osx.md
Last active April 7, 2021 05:59
mac 安裝 Spark 流程

手動下載 Spark 和編譯

Download page 下載 2.2.0(下載當下為最新版本)

版本組合:

  • Spark runs on Java 8+, Python 2.7+/3.4+ and R 3.1+. For the Scala API, Spark 2.2.0 uses Scala 2.11. You will need to use a compatible Scala version (2.11.x).
  • Note that support for Java 7, Python 2.6 and old Hadoop versions before 2.6.5 were removed as of Spark 2.2.0.
  • Note that support for Scala 2.10 is deprecated as of Spark 2.1.0, and may be removed in Spark 2.3.0.
  • 2.2.0 版本一定要搭配 java 8 不然會噴出類似下面的錯誤 QQ
@chairco
chairco / qwiklabs-training.md
Created March 18, 2021 01:27
Create and Manage Cloud Resources: Challenge Lab

task1

gcloud compute instances create jumphost --machine-type f1-micro --zone us-east1-b

task2

gcloud config set compute/zone us-east1-b
gcloud container clusters create nucleus-webserver1
gcloud container clusters get-credentials nucleus-webserver1
@chairco
chairco / leetcode.md
Last active February 20, 2021 08:34
leecode, 30 分鐘來解題。多多用腦身體好,就從解決 leetcode 問題開始吧!
@chairco
chairco / asgi-zh_TW.rst
Last active December 7, 2020 08:45
ASGI 規範中文版

ASGI (Asynchronous Server Gateway Interface) Specification

Version: 2.0 (2017-11-28)

Abstract 摘要 ========

This document proposes a standard interface between network protocol

@chairco
chairco / TWstock_observation.md
Last active August 4, 2020 06:42
台股觀察記錄

2020/7/2

仁寶(2324)

  • 投信除 7/1 賣外連買 10 日,且籌碼集中度 一日: 37.24%, 三日: 8.17%。主要一日與三日購買券商為合庫、台灣匯立、統一、元大皆為千張
  • 除權息日期為 7/17,現金配息 1.2 元,以 7/2 收盤 19.6 元,換算後大約 6.12% 殖利率
  • 低點 15 元到 19 元大約 26% 漲幅(落後其他相同產業)
  • 歷史來看除息時價位大約都落在 19.x 元,填息不定,但每年大概都有填息
  • 股本過大,大約四百萬張
  • 外資持有部位大,投信持有部位小
  • 本業沒有特別亮眼,沒有接到蘋果主力產品
  • 目前主力開始發動第二天,可以小接兩張試試
@chairco
chairco / stock_tech_index.md
Created August 4, 2020 06:40
Stock_tech_index

技術指標

三角收斂

  1. 當股市推移過程中每日低點位置逐漸推高,高點位置未創新高。會呈現底點連線逐漸增高,可視為市場推高底點價格(有人吃貨)待籌碼足夠則會表態強攻 ex: 緯創 20200710-202008