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
KERNEL=="ttyUSB*", GROUP="grpname", MODE="0666" |
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
;; Environment dependent settings | |
;;use (eq window-system `name) and (eq emacs-major-version num) | |
(cond | |
((eq window-system nil) | |
(load-file "~/.emacs.d/terminal.el")) | |
((eq window-system `ns) | |
(load-file "~/.emacs.d/cocoa.el")) | |
((eq window-system `mac) | |
(load-file "~/.emacs.d/carbon.el")) | |
((eq window-system `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
import ast | |
import inspect | |
import sys | |
def create_func_from_ast(targ, arg_globals=globals()): | |
source = "def __target_func__(*args, **kw): return True\n" | |
func_ast = ast.parse(source) | |
func_ast.body[0].body[0].value = targ | |
func_ast = ast.fix_missing_locations(func_ast) | |
code = compile(func_ast, '<string>', 'exec') |
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
#------------------------------------------------------------------------------- | |
# get an AST of a function defined in globals() | |
#------------------------------------------------------------------------------- | |
import ast | |
import inspect | |
def getFunctionAst(name): | |
if name not in globals(): | |
raise NameError("name '%s' is not defined" % name) | |
func = globals()[name] | |
source = inspect.getsource(func) |
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
module test_gray_code; | |
parameter DWIDTH = 10; | |
function [DWIDTH-1:0] to_gray; | |
input [DWIDTH-1:0] in; | |
to_gray = in ^ (in >> 1); | |
endfunction | |
function [DWIDTH-1:0] to_binary; |
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
module test; | |
parameter DATA_WIDTH = 32; | |
parameter ADDR_LEN = 10; | |
reg CLK0; | |
reg RST0; | |
wire [DATA_WIDTH-1:0] Q; | |
reg DEQ; | |
wire EMPTY; | |
wire ALM_EMPTY; |
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
#1.upto(?d){|i|puts"#{i%3<1?'Fizz':i%5>0?i:''}#{'Buzz'if i%5<1}"} | |
#1.upto(?d){|i|puts [[:Fizz][i%3],[:Buzz][i%5]]*''} | |
#1.upto(?d){|i|i%3<1&&x=:Fizz;puts i%5<1?"#{x}Buzz":x||i} | |
#1.upto(?d){|i|puts [i%3<1?:Fizz:i%5>0?i:'',[:Buzz][i%5]]*''} | |
#?d.times{|i|puts [i%3<1?:Fizz:i%5>0?i:'',[:Buzz][i%5]]*''} | |
100.times{|i|i%3<1&&x=:Fizz;puts i%5<1?"#{x}Buzz":x||i} |
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 ruby | |
DATA = "************************** | |
*S* * * | |
* * * * ************* * | |
* * * ************ * | |
* * * | |
************** *********** | |
* * | |
** *********************** | |
* * G * |
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 ruby | |
USAGE = "$ ruby timer.rb time time ..." | |
if ARGV.length == 0 then | |
puts USAGE | |
exit | |
end | |
tl = [] |
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 ruby | |
IO.popen("nkf -g *","r+"){|io| | |
while (l = io.gets) != nil | |
if /(^.*):Shift_JIS$/ =~ l then | |
tmp = $1 | |
if /(.*)\.Shift_JIS$/ =~ $1 then | |
next | |
end | |
print "S: #{tmp}\n" |
OlderNewer