Skip to content

Instantly share code, notes, and snippets.

View beisong7's full-sized avatar
🚀
Bring me the sky...

Benjamin Isong beisong7

🚀
Bring me the sky...
View GitHub Profile
@beisong7
beisong7 / ec2-check.py
Last active December 12, 2023 03:29
check ec2 instances
import boto3
def lambda_handler(event, context):
# List of EC2 instance IDs to check
instance_ids_to_check = ['i-08ac25730cea1a2a0', 'i-05f6ac34768663efc', 'i-0123456789abcdef2']
# Print the list of instances to check
print(f"Instances to check: {instance_ids_to_check}")
# Check the EC2 instance state for each instance in the list
@beisong7
beisong7 / create-ec2.yaml
Created December 12, 2023 01:21
cloud formation ec2
AWSTemplateFormatVersion: "2010-09-09"
Description: A sample template
Resources:
Ec2CloudForm: #An inline comment
Type: "AWS::EC2::Instance"
Properties:
ImageId: "ami-06aa3f7caf3a30282" #Another comment -- This is a Linux AMI
InstanceType: t2.micro
KeyName: nvirginia
@beisong7
beisong7 / sample.dart
Created May 2, 2023 12:50
class dart code
// A person. The implicit interface contains greet().
class Person {
// In the interface, but visible only in this library.
final String _name;
// Not in the interface, since this is a constructor.
Person(this._name);
// In the interface.
String greet(String who) => 'Hello, $who. I am $_name.';
@beisong7
beisong7 / excelArrayToSearchableCollection.php
Last active March 21, 2023 14:08
Excel import to collection to enable search within the excel (Laravel)
<?php
$headers = array();
$raw_data = array();
foreach($client[0] as $pos=>$row){
if($pos === 0){
//get keys
$headers = $row;
}else{
// dd($row, $headers);
@beisong7
beisong7 / sampledb.sql
Created September 19, 2022 00:08
sample database schema
DROP DATABASE IF EXISTS mydatabase;
CREATE DATABASE mydatabase;
DROP TABLE IF EXISTS mydatabase.customers;
DROP TABLE IF EXISTS mydatabase.payments;
CREATE TABLE mydatabase.customers (
customerId INT NOT NULL AUTO_INCREMENT,
email VARCHAR(255) NOT NULL,
createTime TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP,
@beisong7
beisong7 / index.html
Created September 10, 2022 20:19
test gist
<html>
<head>
<title>your_domain website</title>
</head>
<body>
<h1>Hello World!</h1>
<p>This is the landing page of <strong>your_domain</strong>.</p>
</body>
</html>
@beisong7
beisong7 / ImageTrait.php
Last active August 4, 2022 09:05
This is an Image trait on PHP (Laravel)
<?php
namespace App\Traits\Image;
use App\Models\ImageUpload;
use Carbon\Carbon;
use Illuminate\Support\Str;
use Intervention\Image\Facades\Image;
trait ImageTrait {

DAMP - Setup an Apache, MySQL & PHP local server using Docker

Prerequisites

Setup

  1. Create a new directory for your local server (MY_APP is used as a placeholder)
  2. Add docker-compose.yml, Dockerfile and nginx.conf files to the root of your server directory.
  3. With your favorite terminal application:
@beisong7
beisong7 / MailgunTrait.php
Last active December 9, 2021 06:40
Mailgun API email sending
<?php
namespace App\Traits\General;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Str;
use Illuminate\Support\Facades\URL;
trait Mailer{
@beisong7
beisong7 / create_payments_table.php
Last active February 24, 2021 09:44
Payment Schematics
<?php
Schema::create('payments', function (Blueprint $table) {
$table->bigIncrements('id');
$table->uuid('uuid')->unique();
$table->uuid('member_id')->nullable(); // the person paying uuid
$table->uuid('subscription_id')->nullable(); //if you have a subscription table else delete this line
$table->uuid('transaction_id')->nullable();
$table->float('amount', 10, 2)->nullable();
$table->string('reference_id')->nullable(); //paystack or flutter reference