Skip to content

Instantly share code, notes, and snippets.

View llSourcell's full-sized avatar

Siraj Raval llSourcell

View GitHub Profile

To convert ford:

python faceswap.py extract -i ~/faceswap/photo/ford -o ~/faceswap/data/ford

To convert cage:

python faceswap.py extract -i ~/faceswap/photo/cage -o ~/faceswap/data/cage

//pseudo code
create_account():
trustee_reward = (1000*12) * 1.02 ** years
accounts[message.sender] = (block.time – 1month, 0, trustee_reward)
add_account(account1, account2):
//somehow check that both accounts signed the message
if int(account1) > int(acount2):
trustees[account1].append(account2)
else:
def md5(message):
message = bytearray(message) #copy our input into a mutable buffer
orig_len_in_bits = (8 * len(message)) & 0xffffffffffffffff
message.append(0x80)
while len(message)%64 != 56:
message.append(0)
message += orig_len_in_bits.to_bytes(8, byteorder='little')
hash_pieces = init_values[:]
require 'stringio'
# Calculates SHA-1 message digest of _string_. Returns binary digest.
# For hexadecimal digest, use +*sha1(string).unpack('H*')+.
#--
# This is a simple, pure-Ruby implementation of SHA-1, following
# the algorithm in FIPS 180-1.
#++
def sha1(string)
# functions and constants
from sklearn import svm
from sklearn import datasets
#ML Model
clf = svm.SVC()
#Load Data
iris = datasets.load_iris()
X, y = iris.data, iris.target
def linear_regression(X, y, m_current=0, b_current=0, epochs=1000, learning_rate=0.0001):
N = float(len(y))
for i in range(epochs):
y_current = (m_current * X) + b_current
cost = sum([data**2 for data in (y-y_current)]) / N
m_gradient = -(2/N) * sum(X * (y - y_current))
b_gradient = -(2/N) * sum(y - y_current)
m_current = m_current - (learning_rate * m_gradient)
b_current = b_current - (learning_rate * b_gradient)
return m_current, b_current, cost
pragma solidity ^0.4.16;
contract HelloWorld {
uint256 counter = 5; //state variable we assigned earlier
function add() public { //increases counter by 1
counter++;
}
function subtract() public { //decreases counter by 1
counter--;
<pre><code>
pragma solidity ^0.4.0;
contract SimpleAuction {
// Parameters of the auction.
// Times are either
// absolute unix timestamps (seconds since 1970-01-01)
// or time periods in seconds.
// address public beneficiary;
// uint public auctionStart;
contract KittyAccessControl
contract KittyBase is KittyAccessControl
contract KittyOwnership is KittyBase, ERC721
contract KittyBreeding is KittyOwnership
contract KittyAuction is KittyBreeding
contract KittyMinting is KittyAuction
contract KittyCore is KittyMinting
<html>
<head>
<!-- Load TensorFlow.js -->
<script src="https://cdn.jsdelivr.net/npm/@tensorflow/[email protected]"> </script>
<script>
// CODE GOES HERE
</script>
</head>