Skip to content

Instantly share code, notes, and snippets.

View DoguD's full-sized avatar
🎯
Focusing

Doğu Deniz Uğur DoguD

🎯
Focusing
View GitHub Profile
<role>
You are Lovable, an AI editor that creates and modifies web applications. You assist users by chatting with them and making changes to their code in real-time. You understand that users can see a live preview of their application in an iframe on the right side of the screen while you make code changes. Users can upload images to the project, and you can use them in your responses. You can access the console logs of the application in order to debug and use them to help you make changes.
Not every interaction requires code changes - you're happy to discuss, explain concepts, or provide guidance without modifying the codebase. When code changes are needed, you make efficient and effective updates to React codebases while following best practices for maintainability and readability. You take pride in keeping things simple and elegant. You are friendly and helpful, always aiming to provide clear explanations whether you're making changes or just chatting.
Current date: 2025-06-15
</role>
<guidelines>
Currently reading:
Yaratıcı Eylem by Rick Rubin
Recently read:
Muhtesem Gatsby by F. Scott Fitzgerald
@DoguD
DoguD / ChaliceDeployPolicy.json
Created August 28, 2024 14:18
Policy to be used for running `chalice deploy` with Github Actions.
{
"Version": "2024-08-28",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"iam:GetRole",
"logs:DeleteLogGroup",
"apigateway:PUT",
function buy(uint256 tokenId) payable {
require(msg.value >= price, "Payment not enough");
address _currentOwner = ownerOf(tokenId);
_transfer(_currentOwner, msg.sender, tokenId);
bool sent = _currentOwner.send(msg.value);
require(sent, "Failed to send Ether");
}
@DoguD
DoguD / Version2-Dangerous.sol
Created November 15, 2022 08:46
A banking smart contract with a malicious steal function inside.
// contracts/Version1-Safe.sol
pragma solidity ^0.8.0;
interface IERC20 {
function transferFrom(address from, address to, uint256 value) external returns(bool);
function transfer(address to, uint256 value) external returns(bool);
}
contract Bank2 {
@DoguD
DoguD / Version1-Safe.sol
Created November 15, 2022 08:39
A simple bank smart contract.
// contracts/Version1-Safe.sol
pragma solidity ^0.8.0;
interface IERC20 {
function transferFrom(address from, address to, uint256 value) external returns(bool);
function transfer(address to, uint256 value) external returns(bool);
}
contract Bank {
@DoguD
DoguD / pipex.c
Created October 16, 2022 10:37 — forked from aspatic/pipex.c
Multiple pipes in C
/*
** pipex.c - multipipes support
*/
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
/*
* loop over commands by sharing
// SPDX-License-Identifier: MIT
/**
A simple Solidity smart contract which generates a random number between 0 and the desired max number.
Uses two functions to generate the random number:
- First "prepareRandom" should be called. The function will set the "preparationBlockNumber" to the current block number.
- Second "roll" should be called to generate the number. The function generates a random number using the blockhash of the block when "prepareRandom" has been called. This way, as the blockhash of the block can't be know before the "prepareRandom" transaction goes thorugh,
the result of the roll can't be predicted and thus manipulated.
How many times the roll has been called and all the previous results are recorded in the blockchain.
*/
pragma solidity ^0.8.0;
contract RandomNumbers{
// Result varibles
uint256[] public winnerNumbers;
uint256 public rollCount;
function random(uint256 maxNumber) public view returns (uint256) {
/**
Generates a random number between 0 and maxNumber. Uses current block difficulty, timestamp, caller address, and the blockhash of the block when prepareRandom has been called.
Although the output of this function can be precalculated, the manager not knowing the blockhash of the block they called "prepareRandom" makes the system fair.
pragma solidity ^0.8.0;
contract RandomNumbers{
uint256 public preparationBlockNumber;
bool public canCallRandom;
function prepareRandom() public {
/**
When called sets the preparation block number to the current block number.
*/