Skip to content

Instantly share code, notes, and snippets.

View doitian's full-sized avatar
🎯
Focusing

ian doitian

🎯
Focusing
View GitHub Profile
define pustring
if $argc == 0
help pustring
else
if $arg0.str_ == 0
printf "String \t\t\t= NULL\n"
else
printf "String \t\t\t= \"%s\"\n", $arg0._str
end
printf "String length/size \t= %u/%u\n", $arg0.length_, $arg0.max_size_
;; use appt-convert-time instead if appt is loaded
(defun iy/convert-time (time2conv)
"Convert hour:min[am/pm] format TIME2CONV to minutes from midnight.
A period (.) can be used instead of a colon (:) to separate the
hour and minute parts."
;; Formats that should be accepted:
;; 10:00 10.00 10h00 10h 10am 10:00am 10.00am
(let ((min (if (string-match "[h:.]\\([0-9][0-9]\\)" time2conv)
(string-to-number (match-string 1 time2conv))
0))
#!/usr/bin/env ruby
# A script move removed file or direcotry to trash. It is compatible with Thunar,
# so I have not implemented trash file listing and recovering, you can use Thunar
# to do that. This file depends on trash.rb
$VERBOSE = true
require "optparse"
require "fileutils"
#include <iostream>
class OnErrorHandlerBase
{
public:
virtual ~OnErrorHandlerBase() {}
virtual void on_error(int error) = 0;
};
template<typename Func>
set terminal png transparent truecolor size 1200 800
set output "time1.png"
set terminal png font "DejaVuSansMono"
set title "Query Time"
set xtics nomirror rotate by -45
set xlabel "Keywords"
set ylabel "Time(s)"
set style data linespoints
set key autotitle columnheader
import org.json.simple.JSONObject;
class CmClient
{
private String cmServerUrl;
public CmClient(String url)
{
cmServerUrl = url;
}
#---
# Author:: Ian Yang
# Created:: <2010-05-24 16:18:23>
#+++
#
require 'pp'
def optimal_choise(diff)
optimal_value = 0
optimal_index = 0
#---
# Author:: Ian Yang
# Created:: <2010-05-24 19:44:53>
#+++
#
require 'pp'
class Strategy
attr_accessor :penalty
attr_accessor :debug
#---
# Author:: Ian Yang
# Created:: <2010-05-24 19:44:53>
#+++
#
require 'pp'
class Strategy
attr_accessor :penalty
attr_accessor :debug
CC = g++
LD = $(CC)
CC_FLAGS = -O2 -g0 -Wall
LD_FLAGS =
SRC = $(wildcard *.cpp)
OBJ = $(SRC:.cpp=.o)
BIN = $(SRC:.cpp=)