Skip to content

Instantly share code, notes, and snippets.

@hackhowtofaq
hackhowtofaq / file.py
Created May 23, 2022 14:53 — forked from jericbas/file.py
Chandelier Exit in Python
def avg_true_range(self, df):
ind = range(0,len(df))
indexlist = list(ind)
df.index = indexlist
for index, row in df.iterrows():
if index != 0:
tr1 = row["High"] - row["Low"]
tr2 = abs(row["High"] - df.iloc[index-1]["Close"])
tr3 = abs(row["Low"] - df.iloc[index-1]["Close"])
@hackhowtofaq
hackhowtofaq / gist:2e3e29a8b2c3a2f42ec0
Created February 5, 2016 20:29 — forked from rtaibah/gist:0922731c452c6d1ab682
Linux Mint 17 + Xmonad on Macbook Pro Retina 15

Base installations

sudo apt-get install blueman build-essentials calcurse chromium-browser cpufrequtils gnupg2 gparted hfsprogs imagemagick linux-tools-common lxappearance mplayer rtorrent ruby skype ubuntu-restricted-essentials urlview vagrant vim xclip

System Configurations

Lastpass

@hackhowtofaq
hackhowtofaq / HOWTO.md
Created December 7, 2015 11:44
How to configure NGINX with LetsEncrypt using the simp_le client

How to configure NGINX with LetsEncrypt using the simp_le client.

this includes the nginx configs, as well as the auto renewal steps. I took a bunch of these steps from this blog, and adapted it to how I like.

simp_le issues three return codes depending on the status of the request.

  • 0 if certificate data was created or updated;
  • 1 if renewal not necessary;
  • 2 in case of errors.
@font-face {
font-family: 'MyFontFamily';
src: url('myfont-webfont.eot?') format('embedded-opentype');
}
@font-face {
font-family: 'MyFontFamily';
url(data:font/truetype;charset=utf-8;base64,BASE64_ENCODED_DATA_HERE) format('truetype'),
url(data:font/woff;charset=utf-8;base64,BASE64_ENCODED_DATA_HERE) format('woff'),
url('myfont-webfont.svg#svgFontName') format('svg');
require "net/http"
def start_server
# Remove the X to enable the parameters for tuning.
# These are the default values as of Ruby 2.2.0.
@child = spawn(<<-EOC.split.join(" "))
XRUBY_GC_HEAP_FREE_SLOTS=4096
XRUBY_GC_HEAP_INIT_SLOTS=10000
XRUBY_GC_HEAP_GROWTH_FACTOR=1.8
XRUBY_GC_HEAP_GROWTH_MAX_SLOTS=0
#
# CORS header support
#
# One way to use this is by placing it into a file called "cors_support"
# under your Nginx configuration directory and placing the following
# statement inside your location block(s):
#
# include cors_support;
#
# A limitation to this method is that Nginx doesn't currently send headers
### Rails app generator template. Run it:
### rails new _app_name_ -m https://gist.githubusercontent.com/DamirSvrtan/28a28e50d639b9445bbc/raw/app_template.rb
bin_setup_file = <<-FILE
#!/bin/sh
bundle install
bundle exec rake db:setup
FILE
create_file 'bin/setup', bin_setup_file
# Example: List of all sports of the Olympic Games
# HTML Structure:
#
# <div id="content">
# <ul>
# <li>
# <a href="...">SPORT'S NAME</a>
# </li>
# </ul>
# </div>

What is your folder-structure preference for a large-scale Node.js project?

0: Starting from Rails

This is the reference point. All the other options are based off this.

|-- app
|   |-- controllers
|   |   |-- admin
# Nginx+Unicorn best-practices congifuration guide. Heartbleed fixed.
# We use latest stable nginx with fresh **openssl**, **zlib** and **pcre** dependencies.
# Some extra handy modules to use: --with-http_stub_status_module --with-http_gzip_static_module
#
# Deployment structure
#
# SERVER:
# /etc/init.d/nginx (1. nginx)
# /home/app/public_html/app_production/current (Capistrano directory)
#