Skip to content

Instantly share code, notes, and snippets.

Avatar

feliam feliam

View GitHub Profile
@feliam
feliam / wordle.py
Last active January 31, 2022 15:26
View wordle.py
import sys, subprocess, os, re
if not os.path.exists("es.txt"):
subprocess.check_output("wget -c https://raw.githubusercontent.com/lorenbrichter/Words/master/Words/es.txt", shell=True)
if not os.path.exists("corncob_lowercase.txt"):
subprocess.check_output("wget -c http://www.mieliestronk.com/corncob_lowercase.txt", shell=True)
if len(sys.argv) > 1 and sys.argv[1] == "--help":
@feliam
feliam / pepecoin.py
Last active November 3, 2020 15:57
View pepecoin.py
from manticore import ManticoreEVM
from manticore.core.smtlib import Operators
m = ManticoreEVM() # initiate the blockchain
ETHER = 1**18
# Create accounts and the target contract
user = m.create_account(balance=1*ETHER, name='owner')
attacker = m.create_account(balance=1*ETHER, name='attacker')
contract = m.solidity_create_contract('pepecoin.sol', owner=user)
# Prepare symbolic input
View pepecoin.sol
contract PepeCoin{
uint dec = 10**18;
mapping(address => uint) balances;
function buy(uint tokens) public payable{
uint required_wei = (tokens / 10) * dec;
if (msg.value >= required_wei){
balances[msg.sender] += tokens;
}else{
revert();
@feliam
feliam / flows.c
Created August 9, 2019 16:28
Taint tracking side channels
View flows.c
==> flow0.c <==
#include<string.h>
#include<stdio.h>
#include<assert.h>
#define HIGH 0
#define LOW 1
void sha1_hex(char* pwd, size_t co,char *hashed_pwd){
assert (co<9);
@feliam
feliam / flows.c
Created August 9, 2019 16:28
Taint tracking side channels
View flows.c
==> flow0.c <==
#include<string.h>
#include<stdio.h>
#include<assert.h>
#define HIGH 0
#define LOW 1
void sha1_hex(char* pwd, size_t co,char *hashed_pwd){
assert (co<9);
@feliam
feliam / slack_delete2.py
Last active March 11, 2018 05:04
Delete Slack older files that are not liked. Rewrite of https://gist.github.com/jackcarter/d86808449f0d95060a40
View slack_delete2.py
'''
Get your client_id client_secret be registering a new app in your slack
Got to:
https://qgdm.slack.com/oauth?client_id=???????????????????&scope=files:write:user files:read users:read users:read.email reactions:read reactions:write
After authorizing...
http://127.0.0.1:8080/?code=??????????????
Take the code and put it..
View Jan Gray on PDB
1/ PDBs informed by transactions and "stable storage" (@uwaterloo CS454 '86), Alice Pascal '85 (HT @bradtem), C#'88.
2/ I wanted MS C++ to have a persistent program database (and fast incremental builds). PDBs were a step by step way to sneak that in.
3/ MS C/C++ and then VC++ build speeds were slow, especially with windows.h growing and growing.
4/ So C7:VC1/2/4 added precompiled headers (critical heap save/reload/move was skunkworks) and PDBs.
5/ First built MSF -- transacted multistream file (filesystem in a file). Uodate/append new data to streams, commit all chgs w/ one write.
6/ Transactions critical to making PDBs robust. You can interrupt compile at any instant and PDB is always consistent.
7/ This is critical to making incremental compile tools. PDBs updated hundreds of times (e.g. a database) must stay consistent.
8/ So atop MSF implemented various services persisted as streams.
9/ First one, typeserver, provides stable persistent mapping from CodeView type record graphs to dense integer type indice