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/bash | |
# | |
# DESCRIPTION: | |
# | |
# Set the bash prompt according to: | |
# * the active virtualenv | |
# * the branch/status of the current git repository | |
# * the return value of the previous command | |
# * the fact you just came from Windows and are used to having newlines in | |
# your prompts. |
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
;;; str-split : Apr 2006 Doug Hoyte, hcsw.org. | |
;;; ---- | |
;;; Splits a string 'str into a list of strings | |
;;; that were separated by the delimiter character 'ch | |
;;; ---- | |
;;; Efficient as possible given that we can't count on | |
;;; 'str being an immutable string. | |
(define (str-split str ch) | |
(let ((len (string-length str))) |
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
(ns rbl.feature-extraction.user-agent | |
(:use [clojure.core.memoize :only [memo]]) | |
(:require [clojure.tools.logging :as log]) | |
(:import [nl.bitwalker.useragentutils UserAgent DeviceType Browser OperatingSystem])) | |
(defn str->features [string] | |
(try | |
(let [user-agent (UserAgent. (or string ""))] | |
{:browser_group (-> user-agent .getBrowser .getGroup .getName) | |
:os_group (-> user-agent .getOperatingSystem .getGroup .getName) |
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 os, os.path, sys, urllib2, requests | |
class PyPiError(Exception): | |
def __init__(self, value): | |
self.value = value | |
def __str__(self): | |
return repr(self.value) | |
def _chunk_report(bytes_so_far, chunk_size, total_size): | |
if (total_size != None): |
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
#!/usr/bin/env python | |
import re | |
from urllib.request import urlopen | |
# Get the webpage's source html code | |
source = 'http://www.goodinfo.tw/stockinfo/StockDividendSchedule.asp?STOCK_ID=' | |
ID = '2002' | |
filename = ID+'.html' | |
result = urlopen(source+ID).read().decode("big5")#.encode("utf8") |
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
library(shiny) | |
library(datasets) | |
Logged = FALSE; | |
PASSWORD <- data.frame(Brukernavn = "withr", Passord = "25d55ad283aa400af464c76d713c07ad") | |
# Define server logic required to summarize and view the selected dataset | |
shinyServer(function(input, output) { | |
source("www/Login.R", local = TRUE) | |
observe({ | |
if (USER$Logged == TRUE) { |
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
;; geeknote ============================================================== | |
(defun geeknote-mode () | |
(interactive) | |
(eshell-command "python ~/geeknote/geeknote.py settings --editor /Applications/Emacs.app/Contents/MacOS/bin/emacsclient") | |
) | |
(defun geeknote-create (newnote) | |
(interactive "sname: ") | |
(eshell-command | |
(format "python ~/geeknote/geeknote.py create --content WRITE --title %s" newnote)) |
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 subprocess | |
import select | |
from threading import Thread | |
from cStringIO import StringIO | |
def read_stream(stream, output_stream, log_func): | |
while True: | |
r, w, x = select.select([stream.fileno()], [], [], 1.0) | |
if not r: |
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
;;; nodejs-repl-eval.el --- Summary | |
;;; Commentary: | |
;;; | |
;;; Evaluation functions for the `nodejs-repl' package. Written on a stormy | |
;;; night between days of node hacking. | |
;;; | |
;;; Code: | |
(require 'js2-mode) | |
(require 'nodejs-repl) |
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
;;; diary-sync-ical.el --- Sync iCalendar to diary -*- lexical-binding: t; -*- | |
;; Copyright (C) 2015 Kan-Ru Chen (陳侃如) | |
;; Author: Kan-Ru Chen (陳侃如) <kanru@kanru.info> | |
;; Keywords: | |
;; This program is free software; you can redistribute it and/or modify | |
;; it under the terms of the GNU General Public License as published by | |
;; the Free Software Foundation, either version 3 of the License, or |
OlderNewer