Skip to content

Instantly share code, notes, and snippets.

Training ... Unit ready

amanusk amanusk

Training ... Unit ready
View GitHub Profile
amanusk /
Last active February 20, 2023 13:51
Cairo Env for Vim

Setting up Cairo env for vim development

Setup the cairo virtualenv

First things first, you need to install the cairo-lang package, preferably in a virtual env you can later use and upgrade. Currently only python 3.7 and 3.8 is supported

python3 -m venv ~/cairo_venv
source ~/cairo_venv/bin/activate
# add this to your hardhat config
# compilers: [
# {
# version: "0.8.13",
# settings: {
# viaIR: true,
# outputSelection: {
# "*": {
# "*": ["irOptimized"],
# },
DanielVF /
Last active January 16, 2023 01:51
Sample Vulnerability Report


CRITICAL! Almost all USDC liquidity on the REKT/USDC uniswap pool can be stolen, due to an authorization issue with burnFrom() on the REKT token.


Uniswap v2 pools get the prices for their swaps by comparing the relative amounts of each of the two tokens that they hold. If the pool holds very little of token A, and a lot of token B, then it only takes a little of token A to buy a lot of token B.

Currently REKT and USDC are fairly priced in the pool. If there were to suddenly be very little REKT in the pool, but the same amount of USDC, then very little REKT would be able to buy a lot of USDC.

drgorillamd / destroy.sol
Created December 8, 2021 13:23
'selfdestruct but still working'
View destroy.sol
// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;
contract Caller {
uint256 flag = 0;
event InsideBeforeDelegate();
event InsideAfterDelegate();
event OutsideAfterAllWtf();
View ERC20.sol
//SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract Token {
address public owner;
uint256 public totalSupply;
mapping (address => uint256) public balanceOf;
mapping (address => mapping (address => uint256)) public allowance;
string public symbol = "TOKEN";
uint256 public decimals = 18;
amanusk /
Last active February 11, 2023 17:21
Easily change between laptop and external displays in i3 + dmenu
# This script is intended to make switching between laptop and external displays easier when using i3+dmenu
# To run this script, map it to some shortcut in your i3 config, e.g:
# bindsym $mod+p exec --no-startup-id $config/
ErikAugust / spectre.c
Last active December 9, 2022 13:09
Spectre example code
View spectre.c
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#ifdef _MSC_VER
#include <intrin.h> /* for rdtscp and clflush */
#pragma optimize("gt",on)
#include <x86intrin.h> /* for rdtscp and clflush */
simplay / gist:b5c5e84009048a238eea430b55968c1c
Created October 2, 2017 10:52
Install Vim 8 with Python, Python 3, Ruby and Lua support on Ubuntu 16.04
View gist:b5c5e84009048a238eea430b55968c1c
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-gui-common
sudo apt-get install liblua5.1-dev luajit libluajit-5.1 python-dev ruby-dev libperl-dev libncurses5-dev libatk1.0-dev libx11-dev libxpm-dev libxt-dev
#Optional: so vim can be uninstalled again via `dpkg -r vim`
sudo apt-get install checkinstall
sudo rm -rf /usr/local/share/vim /usr/bin/vim
cd ~
Hermanio / thermal-conf.xml
Last active September 14, 2022 12:29
A working thermald configuration file for Thinkpad T430 with a trip point of 90C.
View thermal-conf.xml
<?xml version="1.0"?>
techgaun / vim8.x_with_lua
Last active August 16, 2022 07:30
Install vim with lua support on ubuntu 16.04
View vim8.x_with_lua
I needed to install vim with lua support because I wanted to use neocomplete in my recently installed 15.04 distro. Also, this has python3 enabled by default.
Tested on 16.04 now
Update: This has been tested and verified to work on Ubuntu 16.04 as well. Also, if you wish to use particular branch/tag, you can get the version and then checkout appropriately.
The following (based upon should work though I copied it from history:
sudo apt-get remove --purge vim vim-runtime vim-gnome vim-tiny vim-common vim-gui-common
sudo apt-get build-dep vim-gnome
sudo apt-get install build-essential liblua5.3-0 liblua5.3-dev python-dev ruby-dev libperl-dev libncurses5-dev libgnome2-dev libgnomeui-dev libgtk2.0-dev libatk1.0-dev libbonoboui2-dev libcairo2-dev libx11-dev libxpm-dev libxt-dev