Skip to content

Instantly share code, notes, and snippets.

@arsane
arsane / cmd_replacements.md
Created April 20, 2015 08:05
some check of replacements for windows cmd.

some quick ideas about windows cmd replacements.

  • putty (very good terminal for serial port/telnet/ssh)
  • clink (hook WriteConsole and ReadConsole, support lua extensions)
  • com0com (virtual serial ports)
  • com2tcp (virtual serial with tcp connection)
  • ConEmu (better replacement for windows cmd with clink internally, support gitshell/powershell and other shells)

One simple feature:

  • modify clink to putty like character output.(better&clear font)
{-# OPTIONS_GHC -Wall #-}
-- http://www.cse.chalmers.se/edu/year/2014/course/TDA555/lab3.html
import Data.Char
import Data.List
import Data.List.Split
import Data.Maybe
import Debug.Trace
@arsane
arsane / Sudo.hs
Last active August 29, 2015 14:20
Another Sudoku solver
{-# OPTIONS_GHC -Wall #-}
-- http://www.cs.tufts.edu/~nr/cs257/archive/richard-bird/sudoku.pdf
import Data.List (delete)
import Data.List.Split
import Debug.Trace
type Matrix a = [[a]]
type Board = Matrix Char
var arrays = [
[1, 4, 6, 123, 78, 8, 9, 124, 44],
[44, 6, 9, 123],
[124, 44, 16, 9, 123]
]
function findCommonElements(arrays) {
var sorted_arr = arrays.map(function(arr) {
// sort and remove duplicated elements in each array.
return arr.sort(function (a, b) {return a - b; }).reduce(function (r_arr, ele) {
@arsane
arsane / ijc_dump.py
Last active September 15, 2015 08:28
dump ijc (java card applet) file.
#!/usr/bin/python
import sys
comp_tag_names = [
"None",
"Header", # 1
"Directory", # 2
"Applet", # 3
"Import", # 4
"ConstantPool", # 5
@arsane
arsane / excel_merge.py
Created September 15, 2015 08:30
a python script to copy specified columns from one excel to another.
#!/usr/bin/python
from string import ascii_uppercase
from sys import argv
from os.path import splitext
from openpyxl import Workbook, load_workbook
S_KEY_COL = "A"
L_COLS_FILL = ["C", "D"]
N_ROW_START = 15
;;;; http://stuartsierra.com/2010/01/05/taming-the-gridbaglayout
(import '(javax.swing JFrame JPanel JButton JOptionPane JLabel))
(import 'java.awt.event.ActionListener)
(import '(java.awt GridBagConstraints GridBagLayout Insets))
;;;
(comment
(def button (JButton. "Click Me!"))
(def panel (doto (JPanel.)