Skip to content

Instantly share code, notes, and snippets.

View ooMia's full-sized avatar
🏠
Working from home

Hyeon-hak Kim ooMia

🏠
Working from home
View GitHub Profile
🌞 Morning 98 commits █████▊░░░░░░░░░░░░░░░ 27.8%
🌆 Daytime 143 commits ████████▌░░░░░░░░░░░░ 40.6%
🌃 Evening 75 commits ████▍░░░░░░░░░░░░░░░░ 21.3%
🌙 Night 36 commits ██▏░░░░░░░░░░░░░░░░░░ 10.2%
@ooMia
ooMia / swap-2G.sh
Last active June 7, 2024 02:19
AWS instance swap memory auto-configure shell script
#!/bin/bash
# running command
# wget https://gist.githubusercontent.com/ooMia/9a0cfd5f7f9a618baa62542633d457b8/raw/a36ca84d3e6a888a39bef61a9f4160b24c3472f9/swap-2G.sh -O swap.sh && sudo chmod +x swap.sh && ./swap.sh
# ref: https://repost.aws/knowledge-center/ec2-memory-swap-file
# 1. create a swap file on the root file system
sudo dd if=/dev/zero of=/swapfile bs=64M count=32
# 2. Update the read and write permissions for the swap file
sudo chmod 600 /swapfile
@ooMia
ooMia / Staker.sol
Last active June 20, 2024 03:59
se-2-challenges: decentralized-staking contract
// SPDX-License-Identifier: MIT
pragma solidity 0.8.4; //Do not change the solidity version as it negativly impacts submission grading
// +--------+
// | import |
// +--------+
// import "hardhat/console.sol";
import "./ExampleExternalContract.sol";
@ooMia
ooMia / contracts...Vendor.sol
Created June 25, 2024 04:40
Created using remix-ide: Realtime Ethereum Contract Compiler and Runtime. Load this file by pasting this gists URL or ID at https://remix.ethereum.org/#version=soljson-v0.8.4+commit.c7e474f2.js&optimize=false&runs=200&gist=
pragma solidity 0.8.4; //Do not change the solidity version as it negativly impacts submission grading
// SPDX-License-Identifier: MIT
import "@openzeppelin/contracts/access/Ownable.sol";
import "./YourToken.sol";
interface IVendor {
function buyTokens() external payable;
function withdraw() external;
@ooMia
ooMia / get_github_avatar.sh
Last active July 7, 2024 16:07
Script to get GitHub avatar
#!/bin/bash
# Script to get GitHub avatar
# Prompt the user for the GitHub username
read -p "Enter GitHub username: " username
# Make a GET request to the GitHub API to fetch the user's avatar URL
# Use awk to extract the avatar_url from the JSON response
avatar_url=$(curl -s "https://api.github.com/users/$username" | awk -F '"' '/avatar_url/{print $4}')
@ooMia
ooMia / get_github_avatar.ps1
Created July 7, 2024 15:41
PowerShell script to get GitHub avatar
# PowerShell script to get GitHub avatar
# Prompt the user for the GitHub username
$username = Read-Host "Enter GitHub username"
# Make a GET request to the GitHub API to fetch the user's avatar URL
$response = Invoke-RestMethod -Uri "https://api.github.com/users/$username"
$id = $response.id
$avatar_url = $response.avatar_url