This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# calculating RSI (gives the same values as TradingView) | |
# https://stackoverflow.com/questions/20526414/relative-strength-index-in-python-pandas | |
def RSI(series, period=14): | |
delta = series.diff().dropna() | |
ups = delta * 0 | |
downs = ups.copy() | |
ups[delta > 0] = delta[delta > 0] | |
downs[delta < 0] = -delta[delta < 0] | |
ups[ups.index[period-1]] = np.mean( ups[:period] ) #first value is sum of avg gains |
(by @andrestaltz)
If you prefer to watch video tutorials with live-coding, then check out this series I recorded with the same contents as in this article: Egghead.io - Introduction to Reactive Programming.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
#ID='A16FF353-8441-459E-A50C-B071F53F51B7' # Xcode 6.2 | |
ID='992275C1-432A-4CF7-B659-D84ED6D42D3F' # Xcode 6.3 | |
PLIST_BUDDY=/usr/libexec/PlistBuddy | |
function add_compatibility() { | |
"$PLIST_BUDDY" -c "Add DVTPlugInCompatibilityUUIDs:10 string $2" \ | |
"$1/Contents/Info.plist" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import socket | |
import threading | |
import os | |
import subprocess | |
Port = 123 #Shadowsocks 的端口 | |
ShadowsocksPath = "/home/ss" #Shadowsocks 的路径 | |
def CheckService(): | |
sk = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
In order for this to work you need ffmpeg. I tried with version 1.2.1. | |
1) Play the video you want to download in the browser | |
2) Inspect the video element on the page | |
3) Copy the video url from the page source (something like http://devstreaming.apple.com/videos/wwdc/2013/.../101/ref.mov) | |
4) In this url replace "ref.mov" with "iphone_c.m3u8" (for 960x540 resolution) or "atp.m3u8" if you want more (probably 720p?) | |
5) Execute `ffmpeg -y -i http://devstreaming.apple.com/videos/wwdc/2013/.../101/iphone_c.m3u8 output.mp4` | |
6) There is your video :) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "rubygems" | |
require "yajl" | |
require "openssl" | |
require "socket" | |
device_token = '39cac56f 986a0e66 3c4fd4f4 68df5598 024d2ca3 8b9f307c 741c180e 9fc30c62' | |
device_token = device_token.gsub(" ", "") | |
the_byte_token = [device_token].pack("H*") | |
file = File.open("ruby_the_byte_token", "wb") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dispatch_block_t RecursiveBlock(void (^block)(dispatch_block_t recurse)) | |
{ | |
// assuming ARC, so no explicit copy | |
return ^{ block(RecursiveBlock(block)); }; | |
} | |
typedef void (^OneParameterBlock)(id parameter); | |
OneParameterBlock RecursiveBlock1(void (^block)(OneParameterBlock recurse, id parameter)) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -------------------- CRSegmentedCell.h ------------------------------ | |
#import <Cocoa/Cocoa.h> | |
@interface CRSegmentedCell : NSSegmentedCell { | |
NSInteger highlightedSegment; | |
} | |
@property(assign) NSInteger highlightedSegment; | |
@end |
NewerOlder