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 sys | |
import unicodedata | |
from collections import defaultdict | |
from PIL import ImageFont, ImageDraw, Image | |
# Steal from https://stackoverflow.com/questions/14245893/efficiently-list-all-characters-in-a-given-unicode-category | |
def number_decimal_digit(): | |
unicode_category = defaultdict(list) | |
# very expensive here |
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
(ql:quickload '(ningle clack woo)) | |
(defun current-year () | |
(multiple-value-bind | |
(second minute hour date month year day-of-week dst-p tz) | |
(get-decoded-time) | |
(declare (ignore minute hour date month day-of-week dst-p tz)) | |
year)) | |
(defun current-saving (today_num) |
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
from bs4 import BeautifulSoup | |
import requests | |
URL = "http://www.bangchak.co.th/oilprice-widget.aspx" | |
FUEL_TYPE = ["Hi-Diesel", | |
"Gasohol E85", | |
"Gasohol E20", |
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
s = 'azcbobobegghakl' | |
result = '' | |
tmp = '' | |
for i in range(len(s)-1): | |
if s[i] <= s[i+1]: | |
tmp += s[i] | |
if i == len(s) - 2: | |
tmp += s[i+1] | |
if len(tmp) > len(result): |
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 python3 | |
import re | |
import sys | |
import os | |
def show_help(): | |
print("Usage:") | |
print(sys.argv[0] + " <input_srt_file>" + " <output_srt_file>") |
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 2htdp/image) | |
; Ex 3: | |
; f->c : Real -> Real | |
; GIVEN: a temperature in degrees Fahrenheit as an argument | |
; RETURN: the equivalent temperature in degrees Celsius. | |
; Examples: | |
; (f->c 32) => 0 | |
; (f->c 100) => 37.7777777777.... | |
(define (f->c x) |
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 | |
cd /edx/app/edxapp/edx-platform | |
while read NAME; do { echo 'y' ; echo 'y' ; } | sudo -u www-data /edx/bin/python.edxapp ./manage.py cms \ | |
--settings=aws delete_course $NAME; done < /path/to/course_list_file |
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
#lang racket | |
(define c 0) | |
(with-input-from-file "/path/to/file" | |
(thunk | |
(for ([line (in-lines)]) | |
(set! c | |
(+ c | |
(length |
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
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure(2) do |config| | |
config.vbguest.auto_update = false | |
config.vm.define :edx do |edx_config| | |
edx_config.vm.box = "ubuntu/precise64" | |
edx_config.vm.hostname = "edx" |
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 | |
# Fix the length of song which download from Magnatune store. | |
# mag-fix.sh by Phondanai Khanti | |
# Work with .ogg only! | |
# Require package: vorbis-tools | |
# | |
# usage: mag-fix.sh /path/to/source.ogg | |
# For the whole directory example |
NewerOlder