Skip to content

Instantly share code, notes, and snippets.

View abdul's full-sized avatar
🎯
Focusing

Abdul Qabiz abdul

🎯
Focusing
View GitHub Profile
@abdul
abdul / BasicToken.sol
Created January 12, 2018 11:53
Created using browser-solidity: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://ethereum.github.io/browser-solidity/#version=soljson-v0.4.19+commit.c4cbbb05.js&optimize=false&gist=
pragma solidity ^0.4.18;
import './ERC20Basic.sol';
import './SafeMath.sol';
/**
* @title Basic token
* @dev Basic version of StandardToken, with no allowances.
* https://github.com/OpenZeppelin/zeppelin-solidity/
*/
0x00 0 STOP
0x01 3 ADD
0x02 5 MUL
0x03 3 SUB
0x04 5 DIV
0x05 5 SDIV
0x06 5 MOD
0x07 5 SMOD
0x08 8 ADDMOD
0x09 8 MULMOD
@abdul
abdul / filecoin.rb
Created September 11, 2017 17:31 — forked from stefanobernardi/filecoin.rb
Filecoin cap calculation
coins = 0.00 # just to initialize.
price = 1.00 # the price Filecoin states is the minimum
amount_raised = 52000000.00 # they've said they already sold $52M in the presale
total_filecoin_sold = 85000000.00 # the number of Filecoins already sold in the presale. This would be $52M/price (price was $0.75 and investors could choose up to 30% discount. I'm using 85M coins as an assumption (min 69M max 99M).
average_investment = 100000.00 # I'm already being generous here
while total_filecoin_sold < (200000000.00 - coins) do # 200M is the max amount of coins
price = amount_raised/40000000.00 # this is their function, it's always more than $1
price = price * 0.9 # if you want to model an average discount people will choose
coins = average_investment / price # the amount of coins you get with every investment
amount_raised = amount_raised + average_investment # let's add the investment to the total raised
@abdul
abdul / ICO.sol
Created September 11, 2017 16:46
Simple contract for ICO
pragma solidity ^0.4.11;
/**
* @title SafeMath
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal returns (uint256) {
uint256 c = a * b;
@abdul
abdul / docker-compose.yml
Created August 25, 2017 11:28 — forked from 17xande/snipe-it docker-compose.yml
test docker-compose file for Snipe-IT
version: "3"
services:
snipeit:
env_file: ./snipe-it.env
image: snipe/snipe-it
depends_on:
- mysql
ports:
- "80:80"
volumes:
@abdul
abdul / ServerlessDeployBot.yml
Created August 18, 2017 06:20 — forked from ncloward/ServerlessDeployBot.yml
Serverless Deploy Bot Permissions
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'Cloudformation stack to manage permission to deploy a serverless service'
Parameters:
ServiceName:
Description: Name of the Service you want to deploy
Type: String
Resources:
@abdul
abdul / localstack.md
Created August 10, 2017 20:27 — forked from lobster1234/localstack.md
Working with localstack on command line

Starting localstack

C02STG51GTFM:localstack mpandit$ make infra
. .venv/bin/activate; exec localstack/mock/infra.py
Starting local dev environment. CTRL-C to quit.
Starting local Elasticsearch (port 4571)...
Starting mock ES service (port 4578)...
Starting mock S3 server (port 4572)...
Starting mock SNS server (port 4575)...
@abdul
abdul / docker-compose.yml
Last active July 22, 2017 16:19
WordPress Development with Docker
version: '3'
services:
wordpress:
image: wordpress:latest
ports:
- 8080:80
- 8084:443
volumes:
- ./data:/data
- ./src:/var/www/html
@abdul
abdul / GitHub-Forking.md
Created July 11, 2017 18:32 — forked from Chaser324/GitHub-Forking.md
GitHub Standard Fork & Pull Request Workflow

Whether you're trying to give back to the open source community or collaborating on your own projects, knowing how to properly fork and generate pull requests is essential. Unfortunately, it's quite easy to make mistakes or not know what you should do when you're initially learning the process. I know that I certainly had considerable initial trouble with it, and I found a lot of the information on GitHub and around the internet to be rather piecemeal and incomplete - part of the process described here, another there, common hangups in a different place, and so on.

In an attempt to coallate this information for myself and others, this short tutorial is what I've found to be fairly standard procedure for creating a fork, doing your work, issuing a pull request, and merging that pull request back into the original project.

Creating a Fork

Just head over to the GitHub page and click the "Fork" button. It's just that simple. Once you've done that, you can use your favorite git client to clone your repo or j

@abdul
abdul / clean_pyc.sh
Last active July 11, 2017 19:33
Remove .pyc files only when corresponding (source) .py doesn't exist.
#!/usr/bin/env bash
set -e
pycfiles=($(find . -name "*.pyc"))
for i in "${pycfiles[@]}"; do
pyfile="${i%.pyc}.py"
if [ ! -e "$pyfile" ]; then
echo "Removing "$i" because source file ("$pyfile") doesn't exist."
rm $i
fi
done