Skip to content

Instantly share code, notes, and snippets.

View philsong's full-sized avatar

S. philsong

View GitHub Profile
@philsong
philsong / Liquidation_Permanent_Price_Impact.ipynb
Created September 7, 2021 10:55 — forked from sebjai/Liquidation_Permanent_Price_Impact.ipynb
Optimal Execution with linear and non-linear impact. Chapter 6 of Algorithmic and High-Frequency Trading (c) Cartea, Jaimungal, & Penalva, 2015 Cambridge University Press
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@philsong
philsong / Bot.py
Created July 11, 2021 01:38 — forked from guiziyu/Bot.py
Elon Musk Twitter Trading Bot
import time
import os, io
import urllib.request
import tweepy
from google.cloud import vision
from google.cloud import vision_v1
import urllib.parse, urllib.request
import hashlib, hmac, time
import requests
@philsong
philsong / bellman.py
Created February 6, 2021 07:33 — forked from joninvski/bellman.py
Bellman ford python implementation
import pdb
"""
The Bellman-Ford algorithm
Graph API:
iter(graph) gives all nodes
iter(graph[u]) gives neighbours of u
graph[u][v] gives weight of edge (u, v)
"""
@philsong
philsong / 0x5DE45A7985ae5828f153b635B872655222FdB9eC
Created October 20, 2017 10:08
0x5DE45A7985ae5828f153b635B872655222FdB9eC
0x5DE45A7985ae5828f153b635B872655222FdB9eC
@philsong
philsong / RxBus.java
Created October 26, 2016 02:47 — forked from tatocaster/RxBus.java
RxBus singleton
public class RxBus {
private static RxBus instance = null;
private final Subject<Object, Object> _bus = new SerializedSubject<>(PublishSubject.create());
private static RxBus getInstance() {
if (instance == null) {
instance = new RxBus();
}
return instance;
}
@philsong
philsong / PermissionUtils.java
Created October 26, 2016 02:47 — forked from tatocaster/PermissionUtils.java
Utility class for access to runtime permissions.
/**
* Utility class for access to runtime permissions.
*/
public abstract class PermissionUtils {
/**
* Requests the fine location permission. If a rationale with an additional explanation should
* be shown to the user, displays a dialog that triggers the request.
*/
public static void requestPermission(AppCompatActivity activity, int requestId,
@philsong
philsong / RealPathUtil.java
Created October 26, 2016 02:47 — forked from tatocaster/RealPathUtil.java
Real Path Utility class for Android, works for all API
public class RealPathUtil {
public static String getRealPath(Context context, Uri fileUri) {
String realPath;
// SDK < API11
if (Build.VERSION.SDK_INT < 11) {
realPath = RealPathUtil.getRealPathFromURI_BelowAPI11(context, fileUri);
}
// SDK >= 11 && SDK < 19
else if (Build.VERSION.SDK_INT < 19) {
@philsong
philsong / main.go
Created November 15, 2013 15:43 — forked from icub3d/main.go
package main
import (
"bufio"
"bytes"
"flag"
"fmt"
"github.com/golang/groupcache"
"io"
"net"
package main
import (
"bytes"
"fmt"
"github.com/golang/groupcache"
"image"
_ "image/gif"
_ "image/jpeg"
"image/png"
@philsong
philsong / Makefile
Created November 15, 2013 13:42 — forked from border/Makefile
include $(GOROOT)/src/Make.inc
GOFMT=gofmt -spaces=true -tabindent=false -tabwidth=4
all:
$(GC) jsontest.go
$(LD) -o jsontest.out jsontest.$O
format:
$(GOFMT) -w jsontest.go