Skip to content

Instantly share code, notes, and snippets.

@myrfy001
myrfy001 / gist:f4621cba938fa8d9577181a0c06ac666
Created November 13, 2023 04:09
Bluespec SystemVerilog grammar
intLiteral ::= ’0 | ’1
| sizedIntLiteral
| unsizedIntLiteral
sizedIntLiteral ::= bitWidth baseLiteral
unsizedIntLiteral ::= [ sign ] baseLiteral
| [ sign ] decNum
baseLiteral ::= (’d | ’D) decDigitsUnderscore
| (’h | ’H) hexDigitsUnderscore
| (’o | ’O) octDigitsUnderscore
| (’b | ’B) binDigitsUnderscore
@myrfy001
myrfy001 / dup_convert.py
Created June 19, 2020 15:48
滚动重复的srt字幕文件消除重复便于翻译,以及重新恢复多行重复模式
# coding:utf-8
# author: https://github.com/myrfy001
import sys
import collections
class SubtitleBlock:
__slots__ = ("idx_line", "time_line", "text_lines")
@myrfy001
myrfy001 / Highlight DOM elements (include sub DOM) when mouse hover over it in Chrome or Firefox using devTools.md
Created May 14, 2018 02:59
Highlight DOM elements (include sub DOM) when mouse hover over it in Chrome or Firefox using DevTools

Paste the following code into the console panel of the DevTools window of Chrome or Firefox.

The style sheet came from (Web Scraper)[http://webscraper.io/] plugin for Chrome

It is useful for analyse a page layout and you can extend it to select preferred dom elements.

function addStyleString(str) {
    var node = document.createElement('style');
@myrfy001
myrfy001 / 迭代器风格的滑动平均数计算程序.py
Last active October 17, 2017 11:10
迭代器风格的滑动平均数计算程序
# Author myrfy
def moving_average(seq_in, window_size):
sum = 0.0
iter_ = iter(seq_in)
buf_q = deque(maxlen=window_size)
# build the init window
for i in islice(iter_, window_size):
buf_q.append(i)
sum += i
@myrfy001
myrfy001 / 优雅创建多层字典.md
Created September 29, 2017 10:04
优雅创建多层字典