Skip to content

Instantly share code, notes, and snippets.

@omept
omept / backup.go
Last active March 6, 2024 05:19
golang-db-backup
package main
import (
"archive/zip"
"fmt"
"io"
"log"
"os"
"os/exec"
"path/filepath"
@omept
omept / deploy_laravel.sh
Last active May 6, 2024 18:48
Git-Based Laravel Project Deployment and Cleanup Utility
#!/bin/bash
# Define the Git repository URL
REPO_URL="[email protected]:ong-gtp/foodpay.git"
SSH_TO_USE="/home/george/.ssh/githubaccess_id_rsa"
YAPDOOF="/var/www/yapdoof"
# Step 1: Check if needle.txt file exists
if [ -f "needle.txt" ]; then
# Step 7: Create a shared .env file if it doesn't exist
if [ ! -f "shared/.env" ]; then
@omept
omept / maxheap.go
Created March 22, 2023 08:11
Max Heap Implementation In Golang
package main
import (
"fmt"
)
/*
****** Heap (Max heap) ********
*/
@omept
omept / singlyLinkedList.go
Created February 25, 2023 08:16
Singly Linked List Implementation In Go(Golang)
package main
import "fmt"
// ** Singly Linked List **
type SinglyLinkedList struct {
root *Node
size int
}
@omept
omept / fanInMultiplexing.go
Created September 4, 2022 11:30
Fan-in Multiplexing Pattern In Go
package main
import (
"fmt"
"math/rand"
"time"
)
func main() {
rand.Seed(time.Now().UTC().UnixNano()) // seed to enable proper random race time generation per horse
@omept
omept / index.html
Created July 17, 2022 08:38
linear Interpolation and Linear extrapolation
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Segment Intersection</title>
<style>
body {
margin: 0;
@omept
omept / gasStationProblem2.go
Created July 14, 2022 07:51
Gas Station Problem 2
func Execute2() {
gas := []int{1, 5, 3, 3, 5, 3, 1, 3, 4, 5}
cost := []int{5, 2, 2, 8, 2, 4, 2, 5, 1, 2}
sum := 0
tP := 0
prevSum := 0
for i := 0; i < len(gas); i++ {
sum += (gas[i] - cost[i])
if sum < 0 {
@omept
omept / gasStationProblem.go
Last active July 14, 2022 07:50
Gas Station Problem
func Execute() {
gas := []int{1, 5, 3, 3, 5, 3, 1, 3, 4, 5}
cost := []int{5, 2, 2, 8, 2, 4, 2, 5, 1, 2}
tP := -1
for i := 0; i < len(gas); i++ {
if gas[i] > cost[i] {
rtTrnv := traverseScore(0, gas[i:], cost[i:])
if rtTrnv < 0 {
@omept
omept / main.dart
Created March 21, 2022 17:05
Interface-like code review
void main() {
List<LogStructure> logEntries = [
App1Log("Mon 21 2022", "KTFFD"),
App2Log("Tues 21 2022", "MLDDD"),
];
print(logEntries);
}
import React, { useState } from 'react';
import ReactDOM from 'react-dom';
const rowStyle = {
display: 'flex'
}
const squareStyle = {
'width':'60px',
'height':'60px',