Skip to content

Instantly share code, notes, and snippets.

@r2k0
r2k0 / perl_snippets.pl
Created January 13, 2013 19:39
Perl Snippets
#
@r2k0
r2k0 / Think_FIB_Plot_1
Last active December 8, 2019 23:41
Automatic Opening Range and Fibonacci Levels This Thinkscript is designed to plot the OR high, low, 50% fib retrace, and fib extensions for the current day. This will only work correctly on time-based charts, where the OR time frame is divisible by the bar period e.g. 30 minute OR, 10 min bars. An extra fib extension may be used if desired to cr…
#
def na=double.nan;
#
# Define time that OR begins (in hhmm format,
# 0930 is the default):
#
input ORBegin = 0930;
#
# Define time that OR is finished (in hhmm format,
# 10:00 is the default):
@r2k0
r2k0 / sed_snippets.sh
Last active May 16, 2024 14:58
sed examples
##FILE SPACING:
# double space a file
sed G
# double space a file which already has blank lines in it. Output file
# should contain no more than one blank line between lines of text.
sed '/^$/d;G'
# triple space a file
@r2k0
r2k0 / podcasts
Created June 30, 2011 05:39
rthymbox's podcast list
sed -n '/entry type="podcast-feed"/,/<\/entry>/p' ~/.local/share/rhythmbox/rhythmdb.xml | grep -E "(<title>|<location>)"
@r2k0
r2k0 / quotes
Created June 8, 2011 06:18
check all your stocks from CLI
#!/usr/bin/perl -w
@TICKER = ('ERTS','GOOG','AAPL','MSFT','INTC');
foreach $stocks (@TICKER){
print "$stocks\t";
system("curl -s 'http://download.finance.yahoo.com/d/quotes.csv?s=$stocks&f=l1'")
}
@r2k0
r2k0 / stocks
Created June 8, 2011 05:39
Perl script for checking stock prices in CLI
#!/usr/bin/perl -w
while (@ARGV) {
$stocks=$ARGV[0];
shift @ARGV;
print "$stocks\t";
system("curl -s 'http://download.finance.yahoo.com/d/quotes.csv?s=$stocks&f=l1'")
}
@r2k0
r2k0 / fix_rpath.c
Created May 21, 2011 17:40
fix RPATH
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <elf.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
int
@r2k0
r2k0 / md5
Created April 19, 2011 18:04
md5 in utf8 playing w/hashlib
import hashlib
hashlib.md5("foo:bar:123".encode('utf8')).hexdigest()
@r2k0
r2k0 / .vimrc
Created February 21, 2011 09:38
my vimrc
set ls=2
set tabstop=4
set softtabstop=4
set shiftwidth=4
set showcmd "shows what you are typing as a command
set foldmethod=marker "folding
set autoindent
set incsearch
set nobackup
set notitle