Skip to content

Instantly share code, notes, and snippets.

View perymerdeka's full-sized avatar

Feri Lukmansyah perymerdeka

View GitHub Profile
import requests
from bs4 import Beautifulsoup
url = 'https://www.yell.com/ucs/UcsSearchAction.do?'
params = {
'scrambleSeed': '383401705',
'keywords': 'hotel',
'location': 'New York'
}
from django.dispatch import receiver
from allauth.socialaccount.models import SocialAccount
from django.db.models.signals import pre_save
from .models import Users
@receiver(pre_save, sender=SocialAccount)
def add_username(*args, kwargs):
print('Presave')
print(f'args: {args} \n kwargs: {kwargs}')
pragma solidity >=0.7.0 <0.9.0;
contract HelloWorld {
// your contract begin here
}
// SPDX-License-Identifier: MIT
// compiler version must be greater than or equal to 0.8.3 and less than 0.9.0
pragma solidity ^0.8.3;
contract HelloWorld {
string public greet = "Hello World!";
}
# code exec
if __name__ == "__main__":
trans1: str = "Anna send 1 BTC to Feri"
trans2: str = "Feri Send 1.3 BTC to Budi"
trans3: str = "Bagus Send 3.5 BTC to Hadi"
trans4: str = 'Ivan send 5.5 BTC to Feryy'
# transaction List
transact: list = [trans1, trans2, trans3, trans4]
@perymerdeka
perymerdeka / get_transact.py
Created November 8, 2021 22:53
Getting Transaction method
# getting transaction
def get_transaction(self):
print(f"block data: {self.block_data}")
print(f"block hash: {self.block_hash}")
@perymerdeka
perymerdeka / simple_blockchain.py
Last active November 8, 2021 22:48
Class Blockchain
from hashlib import sha256
class Blockchain:
def __init__(self, prev_hash: str, transaction_list: list):
self.prev_hash = prev_hash
self.transaction_list = transaction_list
# block data and concate strings
self.block_data = " - ".join(transaction_list) + " - " + prev_hash
self.block_hash = sha256(self.block_data.encode()).hexdigest()
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:providers/providers/products.dart';
import './screens/products_overview_screen.dart';
import './screens/product_detail_screen.dart';
void main() {
runApp(const MyApp());
}
@perymerdeka
perymerdeka / main.dart
Created October 24, 2021 17:09
Base Project Structure
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import 'package:providers/providers/products.dart';
import './screens/products_overview_screen.dart';
import './screens/product_detail_screen.dart';
void main() {
runApp(const MyApp());
}
// ignore_for_file: deprecated_member_use
import 'package:flutter/material.dart';
import '../screens/product_detail_screen.dart';
class ProductItem extends StatelessWidget {
final String id;
final String title;
final String imageUrl;