Skip to content

Instantly share code, notes, and snippets.

View libert-xyz's full-sized avatar
🗽
/dev/urandom

Libert Schmidt libert-xyz

🗽
/dev/urandom
View GitHub Profile
@libert-xyz
libert-xyz / contracts..._Structs.sol
Created September 5, 2022 21:37
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.16+commit.07a7930e.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
contract Structs {
struct Car {
string model;
uint year;
address owner;
}
@libert-xyz
libert-xyz / contracts..._mapping_loop.sol
Created September 5, 2022 20:44
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.16+commit.07a7930e.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
contract Mapping_loop {
mapping(address => uint) public balances;
mapping(address => bool) public inserted;
address[] public keys;
function set(address _key, uint _val) external {
@libert-xyz
libert-xyz / contracts..._ownable.sol
Created August 20, 2022 19:02
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.16+commit.07a7930e.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
contract Ownable {
address public owner;
uint public counter;
uint public counterPublic;
constructor () {
@libert-xyz
libert-xyz / contracts..._DataTypes.sol
Created August 20, 2022 18:42
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.16+commit.07a7930e.js&optimize=false&runs=200&gist=
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
contract DataTypes {
bool public boo = true;
// unit is only for positive integers
uint8 public u8 = 1;
uint16 public u16 = 14;
uint256 public u256 = 476;
@libert-xyz
libert-xyz / launch_ec2.py
Created March 15, 2021 16:38
Workflow to test custom roles in different AWS amis
import boto3
import time
##AWS
REGION="us-east-1"
PROFILE="default"
##AMI
AMIS=[
{"os": "centos7", "ami": "ami-0affd4508a5d2481b", "distro":"centos"},
@libert-xyz
libert-xyz / ipinfo.sh
Created January 21, 2021 22:33
bash script to get ip info using ipinfo.io API
#!/bin/bash
curl https://ipinfo.io/$1
@libert-xyz
libert-xyz / url_checker.sh
Created June 29, 2020 22:01
Check URL every second
while true; do sleep 1; curl http://www.google.com; echo -e '\n\n\n'$(date);done
@libert-xyz
libert-xyz / get_lastest-amazonLinux2-from-ssm.sh
Created July 1, 2020 22:31
Get the lastest Amazon Linux 2 AMI from SSM Parameter Store using AWS CLI
#!/bin/bash
aws ssm get-parameters --names /aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2 --region us-east-1
@libert-xyz
libert-xyz / ebs_resize.sh
Last active June 26, 2020 16:18
Resize EBS storage from the EC2 itself (Amazon Linux AMI release 2018.03)
#!/bin/bash
# Specify the desired volume size in GiB as a command-line argument. If not specified, default to 20 GiB.
SIZE=${1:-20}
# Install the jq command-line JSON processor.
sudo yum -y install jq
# Get the ID of the envrionment host Amazon EC2 instance.
INSTANCEID=$(curl http://169.254.169.254/latest/meta-data//instance-id)
@libert-xyz
libert-xyz / cloudwatch-unified-linux-http.json
Created June 15, 2020 17:22
CloudWatch Unified Agent to collect httpd logs and metrics
{
"agent": {
"metrics_collection_interval": 60,
"run_as_user": "root"
},
"logs": {
"logs_collected": {
"files": {
"collect_list": [
{