Skip to content

Instantly share code, notes, and snippets.

View ObjSal's full-sized avatar
🎯
Focusing

Salvador Guerrero ObjSal

🎯
Focusing
View GitHub Profile
@ObjSal
ObjSal / Makefile.iphone
Last active May 22, 2019 19:42 — forked from danomatika/Makefile.iphone
FreeImage Makefile for iOS updated for XCode 7.3, tested with macOS 10.11.6 & XCode 7.3
# Configuration for iPhone OS, making static libs
# this will generate both iPhone (arm) and iPhoneSimulator (i386) libs
include Makefile.srcs
CFLAGS = -std=c99 -g -O2 -Wall -Wmissing-prototypes -ffast-math -fno-strict-aliasing -D__ANSI__ -emit-llvm -Wno-c++11-narrowing -Wno-implicit-function-declaration
CXXFLAGS = -std=gnu++14 -stdlib=libc++ -D__ANSI__ -emit-llvm -Wno-c++11-narrowing -Wno-implicit-function-declaration -fvisibility-inlines-hidden
IPHONEOS_DEPLOYMENT_TARGET = 9.3
MACOSX_DEPLOYMENT_TARGET = 10.7
@ObjSal
ObjSal / base58check.py
Last active June 7, 2019 14:35
Validate PKH (or SHA256/RIPEMD160 hash) with base58check.py to detect typing errors (code created from the theory of Grokking Bitcoin)
#!/usr/bin/env python3
#
# Copyright ByteApps 2019
# Author: Salvador Guerrero (salvador.icc@gmail.com)
#
# Tested by encoding and decoding the input with the following example:
# $ echo 5f2613791b36f667fdb8e95608b55e3df4c5f9eb | \
# ./base58check.py -encode | \
# ./base58check.py -decode
# will output:
@ObjSal
ObjSal / node_playground.js
Created March 25, 2020 04:04
Node Playground used while learning Node.js
// I created this script as a playground when learning node.js
// The Majority of examples are grabbed from https://nodejs.dev/
/**
* Make this server reacheable by the world.
* Install ngrok and type `ngrok PORT` and the PORT you want is exposed to the
* internet. You will get a ngrok.io domain, but with a paid subscription you
* can get a custom URL as well as more security options.
*
* Another service you can use is https://github.com/localtunnel/localtunnel
@ObjSal
ObjSal / EncodingUtil.js
Last active April 19, 2020 20:14
Encoding Node.js responses with gzip, deflate and bf without third-party modules
// Author: Salvador Guerrero
'use strict'
// https://nodejs.org/api/zlib.html
const zlib = require('zlib')
const kGzip = 'gzip'
const kDeflate = 'deflate'
const kBr = 'br'
@ObjSal
ObjSal / app.js
Created May 7, 2020 09:03
Secure Salted Password Hashing on client and server side
// Author: Salvador Guerrero
'use strict'
const fs = require('fs')
const crypto = require('crypto')
// Project modules
const { CreateServer } = require('./server')
const SecurityUtils = require('./security-utils')
@ObjSal
ObjSal / app.js
Created May 20, 2020 08:02
JWT authentication in Node.js
// Author: Salvador Guerrero
'use strict'
const fs = require('fs')
const crypto = require('crypto')
// Third-Party Modules
const {MongoClient, ObjectId} = require('mongodb')
const jwt = require('jsonwebtoken')
@ObjSal
ObjSal / AccountsDemo.sol
Created October 17, 2020 17:33
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.12+commit.27d51765.js&optimize=false&gist=
// Code snippet from Blockchain in Action
pragma solidity ^0.6.0;
contract AccountsDemo {
address public whoDeposited;
uint public depositAmount;
uint public accountBalance;
function deposit() public payable {
whoDeposited = msg.sender;
@ObjSal
ObjSal / AguilaCoin.sol
Created December 1, 2020 02:41
Implementation of AguilaCoin (a Chore Coin) an ERC-20 Token
// SPDX-License-Identifier: MIT
pragma solidity >=0.4.22 <0.8.0;
contract AguilaCoin {
uint256 private _totalSupply;
mapping (address => uint256) private _balances;
mapping (address => mapping (address => uint256)) private _allowed;
@ObjSal
ObjSal / hashcash.py
Created September 30, 2022 09:13
Hashcash
# https://en.wikipedia.org/wiki/Hashcash
# Author: https://twitter.com/ObjSal
import hashlib
import base64
from math import ceil
import re
import datetime
'''
@ObjSal
ObjSal / not-following-back.py
Created February 7, 2023 05:05
Print users not following back on twitter
#!/usr/bin/env python3
#####################################################################################
# WARNING: IF ACCOUNT HAVE MORE THAN 5K FOLLOWERS/FRIENDS THEN IT NEEDS TO BE TWEAKED
#####################################################################################
import math
import json
import requests