Skip to content

Instantly share code, notes, and snippets.

View matheusfillipe's full-sized avatar

Matheus Fillipe matheusfillipe

  • https://gitlab.com/matheusfillipeag
  • Germany
View GitHub Profile
@matheusfillipe
matheusfillipe / proofOfWork.js
Last active April 26, 2022 23:49
Simple proof of work concept using javascript
// Proof or work
const difficulty = 3
async function sha256(message) {
const msgBuffer = new TextEncoder().encode(message);
const hashBuffer = await crypto.subtle.digest('SHA-256', msgBuffer);
const hashArray = Array.from(new Uint8Array(hashBuffer));
const hashHex = hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
return hashHex;
}
@matheusfillipe
matheusfillipe / fixkeymaps.py
Last active April 23, 2022 04:02
Remove duplicated shortcuts on blender keymaps
# Reads all .py files in the current directory and checks if they have the global keyconfig_data
# caracteristic of blender keymaps and loops over the items of the keymaps removing duplicates.
# In the end saves them to the output directory
from pathlib import Path
from pprint import pformat
output = "output/"
boilerplate = """\
keyconfig_version = (3, 2, 4)
@matheusfillipe
matheusfillipe / paste_this_in_js_console.js
Created April 19, 2022 23:59 — forked from Zibri/paste_this_in_js_console.js
Minimal javascript IRC client in console
function irc(nickname, server, chan, onmsg, onjoin) {
nickname = nickname || "nick_" + new Date().getTime().toString(36) + new Date().getMilliseconds().toString(36)
chan = chan || "Z" + new Date().getTime().toString(18) + Math.random().toString(36).substring(2)
server = server || "irc.unrealircd.org"
var init = 0
var ws = new WebSocket("wss://" + server);
var s = (c,l)=>setTimeout(console.log.bind(this, "%c%s", "font-size: 14px; color:" + c, new Date().toLocaleString("it") + ": " + l))
ws.onmessage = m=>{
if (m.data.indexOf("PING") == 0)
ws.send(m.data.replace("PI", "PO"));
@matheusfillipe
matheusfillipe / index.js
Last active April 1, 2022 05:31
Get token price from pancake swap
let pancakeSwapAbi = [{"inputs":[{"internalType":"address","name":"_factory","type":"address"},{"internalType":"address","name":"_WETH","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"WETH","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"tokenA","type":"address"},{"internalType":"address","name":"tokenB","type":"address"},{"internalType":"uint256","name":"amountADesired","type":"uint256"},{"internalType":"uint256","name":"amountBDesired","type":"uint256"},{"internalType":"uint256","name":"amountAMin","type":"uint256"},{"internalType":"uint256","name":"amountBMin","type":"uint256"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"deadline","type":"uint256"}],"name":"addLiquidity","outputs":[{"internalType":"uint256","name":"amountA","type":"uint256"},{"internalType":"uint256","name":"amountB","type":"uint256"},{"interna
#!/bin/bash
coin=0x15Ea6B8481bF1C991aC3dC8e67279d31651a56FE
curl --silent "https://r.poocoin.app/smartchain/assets/${coin}/info.json" | jq
curl --silent 'https://poocoin.app/api2/token-info-bsc' -X POST --data-raw '["'${coin}'"]' | jq
lpAddress=$(curl --silent 'https://poocoin.app/api2/token-info-bsc' -X POST --data-raw '["'${coin}'"]' | jq -r ".[0].lpAddress")
curl --silent 'https://api1.poocoin.app/top-holders?address='"$lpAddress" | jq
{
"initializationOptions": {
"markupKindPreferred": null,
"jediSettings": {
"autoImportModules": []
},
"completion": {
"disableSnippets": false
},
"diagnostics": {
@matheusfillipe
matheusfillipe / windows_pulseaudio_rtp_audio_stream.py
Created September 20, 2021 04:22
Receive pulseaudio's rtp stream on windows's vlc
vlc_path="\"C:\\Program Files (x86)\\VideoLAN\\VLC\\vlc.exe\""
import socket
import struct
import textwrap
from scapy.all import *
import os
from elevate import elevate
rofi usage:
rofi [-options ...]
Command line only options:
-no-config Do not load configuration, use default values.
-v,-version Print the version number and exit.
-dmenu Start in dmenu mode.
-display [string] X server to contact.
${DISPLAY}
-h,-help This help message.
#!/usr/bin/python3
### Install ua-parser:
### sudo pip install pyyaml ua-parser user-agents
import os
from user_agents import parse
print('Content-Type: text/html\n\n')
## This is for printing http headers when you dont know what is what ;)
# for headername in os.environ: