Skip to content

Instantly share code, notes, and snippets.

@shtaxxx
shtaxxx / test.py
Created December 18, 2014 11:12
a python class without self: It works
class Test(object):
def __init__(s, val):
s.val = val
def dump(s):
print(s.val)
a = Test(100)
a.dump()
@shtaxxx
shtaxxx / 70-python-mode.el
Created December 24, 2014 11:40
70-python-mode.el
;; python-mode with jedi
(add-to-list 'load-path "~/.emacs.d/site-lisp/jedi/emacs-deferred")
(add-to-list 'load-path "~/.emacs.d/site-lisp/jedi/emacs-epc")
(add-to-list 'load-path "~/.emacs.d/site-lisp/jedi/emacs-ctable")
(add-to-list 'load-path "~/.emacs.d/site-lisp/jedi/emacs-jedi")
(autoload 'python "python" nil t)
(autoload 'jedi "jedi" "Jedi for python" t)
(add-hook 'python-mode-hook
@shtaxxx
shtaxxx / .cshrc
Created February 5, 2015 13:21
.cshrc for executing bash
if ( ! $?prompt ) then
exit 0
endif
setenv OLDSHELL $SHELL
setenv SHELL /bin/bash
exec /bin/bash --login
@shtaxxx
shtaxxx / fib_pycoram.py
Last active August 29, 2015 14:16
Fibonacci in Python for PyCoRAM High-level Synthesis
iochannel = CoramIoChannel(idx=0, datawidth=32)
def fib(v):
if v <= 0: return 0
if v == 1: return 1
## Recursive call is not supported
# return fib(v-1) + fib(v-2)
r0 = 0
r1 = 1
for i in range(v-1):
@shtaxxx
shtaxxx / getargspec.py
Created March 3, 2015 02:56
getargspec.py: reading argument list of a method in Python
import inspect
def func(a):
return a * a
r = inspect.getargspec(func)
print(r)
@shtaxxx
shtaxxx / bram_vivado.v
Created March 20, 2015 13:41
Block RAM for Vivado 2014.4 (OK case and NG case)
// OK
module OnchipRam_OK #
(
parameter W_D = 32,
parameter W_A = 10
)
(
input CLK,
input [W_A-1:0] addr0,
input we0,
@shtaxxx
shtaxxx / led.py
Last active August 29, 2015 14:23
Blinking LED on Veriloggen
import sys
import os
from veriloggen import *
def mkLed():
m = Module('blinkled')
width = m.Parameter('WIDTH', 8)
clk = m.Input('CLK')
rst = m.Input('RST')
led = m.OutputReg('LED', width)
@shtaxxx
shtaxxx / LedRTL_0x791afe0d4d8c.v
Last active August 29, 2015 14:23
Blinking LED on PyMTL
//-----------------------------------------------------------------------------
// LedRTL_0x791afe0d4d8c
//-----------------------------------------------------------------------------
// dump-vcd: False
`default_nettype none
module LedRTL_0x791afe0d4d8c
(
input wire [ 0:0] clk,
output reg [ 7:0] led,
input wire [ 0:0] reset
@shtaxxx
shtaxxx / 60-udev.rules
Created November 9, 2012 02:29
Automatically setting ttyUSB device permissions
KERNEL=="ttyUSB*", GROUP="grpname", MODE="0666"
@shtaxxx
shtaxxx / init.el
Created November 13, 2012 09:28
My emacs init.el
;; 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)