Skip to content

Instantly share code, notes, and snippets.

View m00zi's full-sized avatar
🎯
Focusing

moss m00zi

🎯
Focusing
View GitHub Profile
@m00zi
m00zi / mslb
Last active November 16, 2022 02:55
#!/bin/bash
cd ~
git clone https://github.com/m00zi/dblb.git
cd dblb
bash build.sh
@m00zi
m00zi / oop-week2-mon.cpp
Created September 12, 2022 23:24
Week2-OOP-Mon
#include <iostream>
using namespace std;
// get max element of array
int findMax(int myArr[]) {
int max = myArr[0];
for (int i = 0; i < 5; i++) {
if (myArr[i] > max) {
max = myArr[i];
}
@m00zi
m00zi / main.go
Created July 6, 2021 11:28 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@m00zi
m00zi / contact.js
Last active January 15, 2021 11:44
// npm install fs-extra concat --save-dev
// place this file in the root of project next to angular.json
const fs = require('fs-extra');
const concat = require('concat');
(async function build() {
const files = [
'./dist/app/runtime.js',
'./dist/app/polyfills.js',
'./dist/app/main.js',
@m00zi
m00zi / db.go
Created January 14, 2021 09:46
Gorm v2 connect to database
// Connect to database
func InitDataDB(dsn string, autoMigrate bool) (db *gorm.DB, err error) {
db, err = gorm.Open("mysql", dsn)
if err != nil {
log.Fatalf("error while open connection to database: %v\n", err)
}
//SetMaxIdleConns sets the maximum number of connections in the idle connection pool.
//If MaxOpenConns is greater than 0 but less than the new MaxIdleConns, then the new MaxIdleConns will be
//reduced to match the MaxOpenConns limit.
@m00zi
m00zi / haproxy.cfg
Created August 20, 2020 12:26 — forked from Xstasy/haproxy.cfg
Load balancing not working tried with balance roundrobin and balance leastconn in ftp-balancer-pool
# HAPROXY Config for FTP
# my apologies for the spacing
global
log 127.0.0.1 local0 info
chroot /var/lib/haproxy
user haproxy
group haproxy
defaults
log global
import 'dart:io';
import 'package:dio/dio.dart';
import 'package:freezed_annotation/freezed_annotation.dart';
part 'network_exceptions.freezed.dart';
@freezed
abstract class NetworkExceptions with _$NetworkExceptions {
const factory NetworkExceptions.requestCancelled() = RequestCancelled;
import 'package:flutter/material.dart';
void main() => runApp(new MyApp());
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return new MaterialApp(
title: 'Flutter Demo',
theme: new ThemeData(
@m00zi
m00zi / main.go
Created July 25, 2020 14:18 — forked from montanaflynn/main.go
Gin request timeout middleware and handler
package main
import (
"context"
"log"
"net/http"
"time"
"github.com/gin-gonic/gin"
)
@m00zi
m00zi / main.go
Created June 16, 2020 10:02 — forked from creack/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"strconv"