Skip to content

Instantly share code, notes, and snippets.

@imtaehyun
imtaehyun / technical-analysis-indicators-without-talib-code.py
Last active January 4, 2025 21:55
Technical analysis Indicators without Talib (code)
# https://www.quantopian.com/posts/technical-analysis-indicators-without-talib-code
import numpy
import pandas as pd
import math as m
#Moving Average
def MA(df, n):
MA = pd.Series(pd.rolling_mean(df['Close'], n), name = 'MA_' + str(n))
df = df.join(MA)
@fernandoaleman
fernandoaleman / clone-git-repo.txt
Last active January 8, 2025 09:51
How to clone git repo with all branches and tags
# Clone repo
git clone --mirror [email protected]/fernandoaleman/app.git app/.git
# Change into app directory
cd app
# Update git config
git config --unset core.bare
# Checkout master branch
@up1
up1 / Hello.java
Last active January 3, 2020 20:28
Robotframework + Google Chrome headless
ChromeOptions chromeOptions = new ChromeOptions();
chromeOptions.setBinary("/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary");
chromeOptions.addArguments("--headless");
WebDriver Driver = new ChromeDriver(chromeOptions);
@jordam
jordam / magiclight.py
Created August 13, 2015 12:59
A script to control MagicLight and other cheap wifi rgb lights
import socket, time
s = socket.socket()
address = ''
port = 5577
r = 0
g = 255
b = 0
keybit = "31".replace(':', '').decode('hex')
keybit += chr(r) + chr(g) + chr(b)
keybit += "00:f0:0f".replace(':', '').decode('hex')
@daurnimator
daurnimator / cqueues-fifo.lua
Created March 17, 2015 21:13
Wrapper around fifo.lua using cqueues to implement non-blocking queues.
local new_fifo = require "fifo"
local cqueues = require "cqueues"
local cc = require "cqueues.condition"
local methods = {}
local mt = {
__index = methods;
}
function methods.new(...)
local cond = cc.new();
@chrisnew
chrisnew / hipache-connector.sh
Last active August 29, 2015 14:13
If you're using hipache as a reverse proxy and use docker container for different virtual hosts, you can use hipache-connector.sh as a supervisor program which automatically registers and unregisters itself from the given hipache server.
#!/usr/bin/env bash
SHUTDOWN=0
IP=127.0.0.1
VHOST="`hostname -f`"
SUBDOMAIN=www
HIPACHE=hipache
DEVICE=eth0
SCHEME=http
@wernight
wernight / inotifyexec.py
Last active December 17, 2024 19:33
inotifywait helper that executes a command on file change (for Linux, put it in ~/bin/)
#!/usr/bin/env python
"""Use inotify to watch a directory and execute a command on file change.
Watch for any file change below current directory (using inotify via pyinotify)
and execute the given command on file change.
Just using inotify-tools `while inotifywait -r -e close_write .; do something; done`
has many issues which are fixed by this tools:
* If your editor creates a backup before writing the file, it'll trigger multiple times.
* If your directory structure is deep, it'll have to reinitialize inotify after each change.
@davidad
davidad / asmrepl.lua
Created March 1, 2014 12:08
Abusing LuaJIT as a REPL for assembly language
-- warning: this is hacky. run at your own risk.
--
-- before you run this, put sum_list.asm in a dynamic library.
--
-- on OSX that means
-- $ nasm -f macho64 sum_list.asm
-- $ libtool -dynamic sum_list.o -o libsum_list.dylib
--
-- on Linux it means
-- $ nasm -f elf64 sum_list.asm
@d11wtq
d11wtq / docker-ssh-forward.bash
Created January 29, 2014 23:32
How to SSH agent forward into a docker container
docker run -rm -t -i -v $(dirname $SSH_AUTH_SOCK) -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK ubuntu /bin/bash
@danharper
danharper / background.js
Last active April 21, 2025 04:10
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});