Skip to content

Instantly share code, notes, and snippets.

View ShiningRay's full-sized avatar
💭
.eth -> .gpt

代码之力 ShiningRay

💭
.eth -> .gpt
View GitHub Profile
@ShiningRay
ShiningRay / ckb.rb
Last active April 25, 2024 16:39
ckb
cell = Cell.last
target = 'ckt1qzda0cr08m85hc8jlnfp3zer7xulejywt49kt2rr0vthywaa50xwsqtgydapmyadqh2h6lndq3eef52h5uq4nnq827utn'
tx = Transaction.new
tx.inputs = [cell]
tx.cell_deps = [
{
"out_point": {
"tx_hash": "0xf8de3bb47d055cdf460d93a2a6e1b05f7432f9777c8c474abf4eec1d4aee5d37",
"index": '0x0'
},
@ShiningRay
ShiningRay / hash_deep_diff.rb
Created April 2, 2023 10:56 — forked from henrik/hash_deep_diff.rb
Recursively diff two Ruby hashes.
# Recursively diff two hashes, showing only the differing values.
# By Henrik Nyh <http://henrik.nyh.se> 2009-07-14 under the MIT license.
#
# Example:
#
# a = {
# "same" => "same",
# "diff" => "a",
# "only a" => "a",
# "nest" => {
@ShiningRay
ShiningRay / fml.sol
Created September 27, 2020 06:59
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.6.12+commit.27d51765.js&optimize=false&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.6.2;
import "https://github.com/OpenZeppelin/openzeppelin-contracts/blob/v3.1.0/contracts/token/ERC20/ERC20.sol";
contract Token is ERC20 {
constructor () public ERC20("FMyLife Token", "FML") {
_mint(msg.sender, 1000000000 * (10 ** uint256(decimals())));
}
http://chronos-st.blogspot.com/2007/12/smalltalk-in-one-page.html
http://www.csci.csusb.edu/dick/samples/smalltalk.syntax.html
Formal EBNF Specification of Smalltalk Syntax
1. Character = ? Any Unicode character ?;
2. WhitespaceCharacter = ? Any space, newline or horizontal tab character ?;
3. DecimalDigit = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9";
4. Letter = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M"
| "N" | "O" | "P" | "Q" | "R" | "S" | "T" | "U" | "V" | "W" | "X" | "Y" | "Z"
@ShiningRay
ShiningRay / lbForth.c
Created January 11, 2020 17:41 — forked from lbruder/lbForth.c
A minimal Forth compiler in ANSI C
/*******************************************************************************
*
* A minimal Forth compiler in C
* By Leif Bruder <leifbruder@gmail.com> http://defineanswer42.wordpress.com
* Release 2014-04-04
*
* Based on Richard W.M. Jones' excellent Jonesforth sources/tutorial
*
* PUBLIC DOMAIN
*
@ShiningRay
ShiningRay / device.js
Created December 9, 2018 03:45
nanomsg req/rep load balancer example
var nano = require('nanomsg');
const async = require('async')
function createWorker(index) {
var worker = nano.socket('rep')
const endpoint = 'inproc://worker' + index;
worker.bind(endpoint);
worker.index = index;
worker.on('data', (buf) => {
var a = buf.toString();
### Keybase proof
I hereby claim:
* I am shiningray on github.
* I am shiningray (https://keybase.io/shiningray) on keybase.
* I have a public key ASB2sATNtdPsmMsCGDEJqYzhArE4fU8xht1gDMk3dWtJego
To claim this, I am signing this object:
@ShiningRay
ShiningRay / init.lua
Created April 7, 2017 09:16
automaticly focus the frontmost window when mouse changed to another screen
-- hs.logger.setGlobalLogLevel('debug')
local logger = hs.logger.new('focus')
hs.timer.doEvery(3, function()
local current = hs.mouse.getCurrentScreen()
-- hs.rawprint(current)
if current and current ~= hs.screen.mainScreen() then
local windows = hs.window.orderedWindows()
for _, l in ipairs(windows) do
if l:screen() == current and l:isStandard() and l:isVisible() then
@ShiningRay
ShiningRay / test.rb
Created January 11, 2017 07:17
def ... end syntax vs define_method
class Test
def initialize
@a = 100
end
a = 100
def test1
a
end
@ShiningRay
ShiningRay / 0_reuse_code.js
Created April 23, 2016 03:43
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console