Skip to content

Instantly share code, notes, and snippets.

View cdarlint's full-sized avatar

cdarlint

  • mathworks.com
  • Beijing, China
  • 08:01 (UTC +08:00)
View GitHub Profile
@refractalize
refractalize / decrypt.rb
Created January 4, 2012 20:11
Decrypt HTTP Live Streaming TS files
def read_m3u8(m3u8)
File.open(m3u8, 'r') do |file|
keyfile = nil
iv = 0
file.each_line do |line|
line.chomp!
if line =~ /^#EXT-X-KEY:METHOD=AES-128,URI="(.*?)"(,IV=0x(.*))?/
keyfile = $1
if $2
iv = $3
@jmkristian
jmkristian / Cartesian.java
Created February 25, 2012 23:27
An implementation of the Cartesian product of ordered collections, in Java.
/* Copyright 2012 LinkedIn Corp.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
@jarshwah
jarshwah / install_cx_Oracle_rhel6.sh
Last active February 23, 2017 22:29
Installing cx_Oracle on Linux Redhat 6 using RPMs
# assuming python and pip are already installed
# installing the instantclient is usually where problems happen
# download the following files from oracle
#
# oracle-instantclient11.2-basic-11.2.0.3.0-1.x86_64.rpm
# oracle-instantclient11.2-devel-11.2.0.3.0-1.x86_64.rpm
# oracle-instantclient11.2-sqlplus-11.2.0.3.0-1.x86_64.rpm
# install the rpms
@pudquick
pudquick / shellista.py
Last active November 12, 2022 16:56
Advanced shell for Pythonista
import os, cmd, sys, re, glob, os.path, shutil, zipfile, tarfile, gzip
# Credits
#
# The python code here was written by pudquick@github
#
# License
#
# This code is released under a standard MIT license.
#
@jexchan
jexchan / TeXIt.tex
Last active August 4, 2023 05:55 — forked from arcthur/TeXIt.tex
Latex with Chinese Support
%!TEX TS-program = xelatex
%!TEX encoding = UTF-8 Unicode
% 以上设定默认使用 XeLaTeX 编译,并指定 Unicode 编码,供 TeXShop 自动识别
% XeLaTeX 示例
\documentclass[12pt]{article}
% XeTeX 配合 fontspec 可以非常方便的设置字体
@davidhq
davidhq / it-ebooks.rb
Created June 8, 2013 11:26
Traverse and download all books from http://it-ebooks.info
require 'nokogiri'
require 'open-uri'
MARK_FILE = "mark.dat"
def wait_for_threads(threads)
print "Waiting for downloads to finish..."
threads.each { |t| t.join }
puts " ok"
end
@aligusnet
aligusnet / ncdc.sh
Last active December 11, 2021 19:56
Download a weather dataset from the National Climatic Data Center (NCDC, http://www .ncdc.noaa.gov/). Prepare it for examples of "Hadoop: The Definitive Guide" book by Tom White. http://www.amazon.com/Hadoop-Definitive-Guide-Tom-White/dp/1449311520 Usage: ./ncdc.sh 1901 1930 # download wheather datasets for period from 1901 to 1930.
#!/usr/bin/env bash
# global parameters
g_tmp_folder="ncdc_tmp";
g_output_folder="ncdc_data";
g_remote_host="ftp.ncdc.noaa.gov";
g_remote_path="pub/data/noaa";
@danfinlay
danfinlay / How to download streaming video.md
Last active March 23, 2024 03:32
How to download a streaming video with Google Chrome

How to download streaming video

Streaming just means a download that they don't want you to keep. But Chrome's developer tools make it easy to access what's really going on under the hood.

Open Developer Tools

From the page where you want to download some things, go into your chrome menu to open the developer tools. You can either:

1.  (On a mac): Command-option-J
2. (On a PC): Control-alt-J
@John07
John07 / HLS_dvr.sh
Last active June 10, 2023 10:40
A small script to make recording http live streams (HLS, those streams that work on iOS devices) nicer on a Mac. Script records the stream for a defined period of time and sends the user notifications if anything goes wrong and once it's done.
# required: ffmpeg (e.g. from homebrew), terminal-notifier from https://github.com/alloy/terminal-notifier
# you can schedule this with launchd to run e.g. weekly
# Specify in seconds how long the script should record (default here is 1 hour).
seconds=3600
# Date format for the recording file name
DATE=`date "+%d-%m-%y_%H-%M"`
# start ffmpeg recording
@cscorley
cscorley / jekyll.py
Last active January 9, 2021 21:47
IPython to Jekyll Markdown
try:
from urllib.parse import quote # Py 3
except ImportError:
from urllib2 import quote # Py 2
import os
import sys
BLOG_DIR = os.environ['BLOG_DIR']
# BLOG_DIR = '/Users/cscorley/git/cscorley.github.io/'