Skip to content

Instantly share code, notes, and snippets.

View jyap808's full-sized avatar

Julian Yap jyap808

View GitHub Profile
package main
import (
"fmt"
"github.com/ethereum/go-ethereum/accounts"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/ethereum/go-ethereum/crypto"
)
@salanfe
salanfe / AdditionContract.sol
Last active July 9, 2022 22:07
Ethereum: python for sending raw JSON-RPC HTTP requests to deploy and interact with a smart contract
pragma solidity ^0.4.18;
contract AdditionContract {
uint public state = 0;
function add(uint value1, uint value2) public {
state = value1 + value2;
}
function getState() public constant returns (uint) {
@sigboe
sigboe / suspend-modules
Last active April 16, 2024 03:57 — forked from mauron85/suspend-modules
Systemd unload modules on sleep
#!/bin/bash
# Put into /lib/systemd/system-sleep/suspend-modules
# chmod a+x /lib/systemd/system-sleep/suspend-modules
# Unloads kernel modules defined in /etc/suspend-modules.d/*.conf
# and /etc/suspend-modules
# with one module per line
# Too see credits, see git history
@miguelmota
miguelmota / sha3.go
Last active September 24, 2022 02:26
Ethereum Sha3 (Keccak256) in Golang
package main
import (
"encoding/hex"
"fmt"
"github.com/ethereum/go-ethereum/crypto/sha3"
)
func main() {
hash := sha3.NewKeccak256()
@miguelmota
miguelmota / ethereum_keys.sh
Last active April 15, 2025 11:46
Generate Ethereum Private key, Public key, and Address using Bash and OpenSSL
# Generate the private and public keys
openssl ecparam -name secp256k1 -genkey -noout | openssl ec -text -noout > key
# Extract the public key and remove the EC prefix 0x04
cat key | grep pub -A 5 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^04//' > pub
# Extract the private key and remove the leading zero byte
cat key | grep priv -A 3 | tail -n +2 | tr -d '\n[:space:]:' | sed 's/^00//' > priv
# Generate the hash and take the address part
@alex35mil
alex35mil / ssl_smtp_example.go
Created September 22, 2017 13:51 — forked from chrisgillis/ssl_smtp_example.go
Golang SSL SMTP Example
package main
import (
"fmt"
"log"
"net"
"net/mail"
"net/smtp"
"crypto/tls"
)
@0xjac
0xjac / private_fork.md
Last active May 15, 2025 22:38
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare [email protected]:usi-systems/easytrace.git

# -*- coding: utf-8 -*-
# Original code found at:
# https://gist.github.com/DenisFromHR/cc863375a6e19dce359d
# http://www.circuitbasics.com/raspberry-pi-i2c-lcd-set-up-and-programming/
"""
Compiled, mashed and generally mutilated 2014-2015 by Denis Pleic
Made available under GNU GENERAL PUBLIC LICENSE
@mattdenner
mattdenner / README.markdown
Last active April 30, 2025 01:10
Suspend and then hibernate after 60 minutes

I found a post about suspending and then going into hibernate that included a really clever script. Turns out that with NixOS this is even esaier to coordinate as you have systemd so can have a before and after service. I just include this in my /etc/nixos/configuration.nix file and nixos-rebuild; then a systemctl suspend or a close of the lid will cause the hibernate timer to be set.

@samkahchiin
samkahchiin / macvim
Last active September 30, 2023 22:15
- How to set the default font size in macvim
# Open Terminal
vim ~/.vimrc
# Mac OS-X -> .vimrc ; Window -> .gvimrc
# Add it in the file and adjust the font size (h12) accordingly
set guifont=Menlo\ Regular:h15