Skip to content

Instantly share code, notes, and snippets.

View mvlabat's full-sized avatar
🦀
Rusting

Vladyslav Batyrenko mvlabat

🦀
Rusting
View GitHub Profile
@spalladino
spalladino / falsehoods-that-ethereum-programmers-believe.md
Last active May 20, 2024 21:04
Falsehoods that Ethereum programmers believe

Falsehoods that Ethereum programmers believe

I recently stumbled upon Falsehoods programmers believe about time zones, which got a good laugh out of me. It reminded me of other great lists of falsehoods, such as about names or time, and made me look for an equivalent for Ethereum. Having found none, here is my humble contribution to this set.

About Gas

Calling estimateGas will return the gas required by my transaction

Calling estimateGas will return the gas that your transaction would require if it were mined now. The current state of the chain may be very different to the state in which your tx will get mined. So when your tx i

@Kestrer
Kestrer / how-to-write-hygienic-macros.md
Created October 17, 2020 05:35
A guide on how to write hygienic Rust macros

How to Write Hygienic Rust Macros

Macro hygiene is the concept of macros that work in all contexts; they don't affect and aren't affected by anything around them. Ideally all macros would be fully hygienic, but there are lots of pitfalls and traps that make it all too easy to accidentally write unhygienic macros. This guide attempts to provide a comprehensive resource for writing the most hygienic macros.

Understanding the Module System

First, a little aside on the details of Rust's module system, and specifically paths; it is

@kucaahbe
kucaahbe / mysql
Last active January 17, 2022 12:05
rails db -p use mycli as MySQL client (shell wrapper for https://www.mycli.net/)
#!/bin/bash
# usage:
# save this file into $HOME/bin/mysql (don't forget to make it executable)
# and make sure $HOME/bin is in PATH environment variable before folder where original mysql binary is located.
# for instance mysql binary is here: /usr/local/bin/mysql, than PATH should be like:
# /home/user/bin:/usr/local/bin:...
set -e
declare -a args=()
@nornagon
nornagon / 1-intro.md
Last active April 20, 2024 18:48
How to make a Minecraft (1.8) mod

How to make a Minecraft mod

Minecraft mods, especially mods which change the client, are by and large written with Forge. If you visit their website, you'll be greeted abruptly by a mysterious message at the top of an SMF forum, with no clear path towards actually... making a mod. I'm documenting here the steps I went through to get started, in the hopes of helping the next person have an easier time of it.

I'll be using Scala for this guide, but it should be fairly easy to adapt these instructions to any JVM language (e.g. clojure or if you're feeling masochistic, Java). I'm also developing on OS X, so some of the commands will be a little different if you're on Linux or Windows. I'm assuming you have some proficiency with your operating system, so I won't go into details about how to adapt those commands to your system.

Background

Minecraft doesn't have an official mod API (despite early [promises](http://notch.t

@desertmonad
desertmonad / 32.asm
Last active November 26, 2018 13:00 — forked from FiloSottile/32.asm
; /usr/local/bin/nasm -f macho 32.asm && ld -macosx_version_min 10.7.0 -o 32 32.o && ./32
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; The .data section is for storing and naming constants.
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
section .data
msg: db "Hello world!", 10
.len: equ $ - msg
@kawakami-o3
kawakami-o3 / IrcSenderSimple.java
Created December 17, 2011 07:38
Simple IRC Client in Java
import java.net.*;
import java.io.*;
import java.util.*;
class IrcSenderSimple {
static void sendString(BufferedWriter bw, String str) {
try {
bw.write(str + "\r\n");
bw.flush();
}
var file = fs.createReadStream(path);
var sha1_for_file = crypto.createHash('sha1');
file.addListener('error', function(err) {
throw err;
});
file.addListener('data', function(data) {
sha1_for_file.update(data);
});
file.addListener('close', function() {