Skip to content

Instantly share code, notes, and snippets.

View cdarlint's full-sized avatar

cdarlint

  • mathworks.com
  • Beijing, China
  • 21:33 (UTC +08:00)
View GitHub Profile
@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
import matplotlib
import matplotlib.pyplot as plt
import tensorflow as tf
import time
def get_times(maximum_time):
device_times = {
"/gpu:0":[],
"/cpu:0":[]
@shionryuu
shionryuu / Roman Hitman.md
Last active January 20, 2019 06:22
Roman Hitman

Encrypted Question

iUxaTwANChoKEDAgQAlAAQUOMAA9AAAAAFaYvG1WmLxtADKLBZkAAAJmAAACNKu8
wBMAFzJhMzhhNGE5MzE2YzQ5ZTVhODMzNTE3YzQ1ZDMxMDcwIDg2MTM5ODVldAMA
E2I4Zjc1N2FlNjQzOWU4NzliYjJhIHwgUm9tYW4gSGl0bWFuCj0gHgAAAAcKL1Rk
NldGb0FBQVRtMXJSR0FnQWhBUndBQAAAAHRRejFqTTRBRnlBUlZkQUNrSUJFU2l3
VU5uMHF1VVVBRElIZ3kyCjVsU1RROFM3R1ZHcU1TeTBxNUlqbjR1cmFJS05zcjRW
@fntlnz
fntlnz / establish-routing-to-docker-osx-container-network
Last active March 29, 2019 18:07 — forked from bhyde/establish-routing-to-boot2docker-container-network
establish-routing-to-docker-osx-container-network
#!/bin/bash
# Script to instruct the Mac how to route packets to the
# software defined network where containers created via boot2docker
# reside. This lets you casually directly to ports (ssh, http, etc. etc.)
# on those containers.
function ERROR(){ echo "ERROR: $*" ; }
function FAIL(){ echo "FAILING: $*" ; exit 1; }
IP_OF_DOCKER_HOST="172.16.42.43"
SDN_NET_FOR_CONTAINERS=$(docker-osx ssh -c 'ip route show' 2> /dev/null | awk '/docker0/{print $1}' )
@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,
@AhmedSoliman
AhmedSoliman / permutations.scala
Created October 8, 2014 09:24
Generate Permutations of String in Scala
/**
* A question I normally ask in Scala interviews, this is not a tail-recursive implementation
*/
object Permutations {
def permutations(s: String): List[String] = {
def merge(ins: String, c: Char): Seq[String] =
for (i <- 0 to ins.length) yield
ins.substring(0, i) + c + ins.substring(i, ins.length)
@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
@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/'
@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";
@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