Skip to content

Instantly share code, notes, and snippets.

View psychemist's full-sized avatar
👽
getting cracked

DIKE psychemist

👽
getting cracked
View GitHub Profile
@psychemist
psychemist / StudentPortal.sol
Last active August 27, 2024 17:07
Classwork for Web3Bridge Week 4 Day 2: Smart Contracts
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.22;
contract StudentPortal {
address owner;
struct Student {
address walletAddress;
string name;
string email;
@psychemist
psychemist / Exploits.sol
Created October 22, 2024 17:17
VIPBank Exploits
// SPDX-License-Identifier: MIT
pragma solidity 0.8.26;
interface IVIPBank {
function deposit() external payable;
function addVIP(address addr) external;
function withdraw(uint _amount) external;
}
contract DoS_Attack {
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;
import {Test, console2} from "forge-std/Test.sol";
import {ChallengeTwo, Exploit} from "../src/ChallengeTwo.sol";
contract ChallengeTwoTest is Test {
ChallengeTwo public challenge;
Exploit public exploit;
uint count;
contract FlashLoanAttacker is IFlashLoanEtherReceiver {
Web3BridgeCXIPool private immutable pool;
constructor(address poolAddress) {
pool = Web3BridgeCXIPool(poolAddress);
}
function attack() external {
pool.flashLoan(address(pool).balance);
@psychemist
psychemist / hyperdrive.cpp
Last active November 25, 2025 13:26
Arduino Starter Project 2
// initialize switch state variable
int switchState = 0;
// setup function runs once: when arduino is powered on
void setup() {
// configure digital pins
pinMode(2, INPUT);
pinMode(3, OUTPUT);
pinMode(4, OUTPUT);
pinMode(5, OUTPUT);
@psychemist
psychemist / love-o-meter.cpp
Last active November 26, 2025 13:30
Arduino Starter Project 3
// declare global constant variables
const int sensorPin = A0;
const float baselineTemp = 20.0;
void setup() {
// open a serial port connection between the Arduino board and computer
// allowing communication at 9600 bauds (bits per second)
Serial.begin(9600);
// assign digital pins as output and toggle off
@psychemist
psychemist / color-mixing-lamp.cpp
Created November 26, 2025 14:51
Arduino Starter Project 4
// set up constants for input and output pins
const int redLEDPin = 9;
const int greenLEDPin = 10;
const int blueLEDPin = 11;
const int redSensorPin = A0;
const int greenSensorPin = A1;
const int blueSensorPin = A2;
// add variables for incoming sensor and output values
@psychemist
psychemist / mood-servo.cpp
Last active December 5, 2025 13:44
Arduino Starter Project 5
// import Servo library
#include <Servo.h>
// create Servo object from library
Servo myServo;
// declare variables for potentiometer pin, analog input value and servo angle
int const potPin = A0;
int potVal;
int angle;
@psychemist
psychemist / light-theremin.cpp
Last active December 5, 2025 15:27
Arduino Starter Project 6
// create variables for calibrating the sensor
int sensorValue;
int sensorLow = 1023;
int sensorHigh = 0;
// create constant for calibration indicator at on-board LED connected to pin 13
const int ledPin = 13;
void setup() {
// set digital pin direction and turn it high
@psychemist
psychemist / keyboard.cpp
Last active December 5, 2025 15:30
Arduinnon Starter Project 7
// set up array of 6 integers representing frequencies
int notes[] = [ 262, 294, 330, 349];
void setup() {
// begin serial communnication
Serial.begin(9600);
}
void loop() {
// read analog value and send to serial monitor