Skip to content

Instantly share code, notes, and snippets.

View SumonMSelim's full-sized avatar
🎯
Focusing

Muhammad Sumon Molla Selim SumonMSelim

🎯
Focusing
View GitHub Profile
@chilampoon
chilampoon / http_load_balancer_setup_gcp.sh
Created July 14, 2021 20:51
Set up an HTTP load balancer with a managed instance group of 2 nginx web servers on Google Cloud Platform (Qwiklab)
# setup
gcloud auth list
gcloud config set compute/zone us-east1-b
gcloud config set compute/region us-east1
# create an instance template
cat << EOF > startup.sh
#! /bin/bash
apt-get update
apt-get install -y nginx
@imasif
imasif / exportDB.sh
Last active June 22, 2020 13:57
Export mongodb database into JSON files, and import the JSON again.
#!/bin/bash
if [ ! $1 ]; then
echo " Example of use: $0 database_name dir_to_store"
exit 1
fi
db=$1
out_dir=$2
if [ ! $out_dir ]; then
out_dir="./"
@mugli
mugli / anmeldung-termin-notifier.sh
Last active February 8, 2023 19:55
Little bash script to repeatedly check if any appointment slot is available for Anmeldung (apartment registration) in Berlin
#!/bin/bash
# Check if xidell is present (required for extracting from webpage using xpath)
if ! command -v xidel &> /dev/null
then
printf "\n\nCould not find xidel \n\n"
echo "You can install it with (on a mac):"
echo "brew install xidel"
exit
fi
@reinink
reinink / query.sql
Last active November 14, 2023 11:08
Text search across multiple tables using MySQL
select
first_name,
last_name
from
users
left join
companies on companies.id = users.company_id
where (
companies.name like 'TERM%' or
first_name like 'TERM%' or
@zspine
zspine / Money.php
Created April 10, 2020 10:23
Doctrine brick money value object
<?php
namespace App\Entity\Embeddable;
use App\Model\Intl\MoneyInterface;
use Brick\Math\BigNumber;
use Brick\Math\Exception\NumberFormatException;
use Brick\Math\RoundingMode;
use Brick\Money\Context\CustomContext;
use Doctrine\ORM\Mapping as ORM;
@rubenvanassche
rubenvanassche / tests.yml
Last active March 3, 2024 11:12
A simple Laravel testing workflow for GitHub Actions
name: Tests (PHP)
on: [push]
jobs:
tests:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
@ralphschindler
ralphschindler / SnapshotCommand.php
Created July 11, 2019 20:26
An example Laravel app command to create and load database snapshots using S3
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Storage;
class SnapshotCommand extends Command
{
@theanam
theanam / logger.js
Created April 5, 2019 17:53
Stdout logs on Steroids
const moment = require('moment');
const colors = {
"green" :"\x1b[32m",
"yellow":"\x1b[33m%s\x1b[0m",
"red":"\x1b[31m",
"cyan":"\x1b[36m",
"blue":"\x1b[34m",
"default":""
}
module.exports = function (message,color="default"){
public function index(Request $request)
{
$sortBy = 'id';
$orderBy = 'desc';
$perPage = 20;
$q = null;
if ($request->has('orderBy')) $orderBy = $request->query('orderBy');
if ($request->has('sortBy')) $sortBy = $request->query('sortBy');
if ($request->has('perPage')) $perPage = $request->query('perPage');
@marufmax
marufmax / App\Exceptions\Handler.php
Last active December 17, 2018 10:15
Laravel/Lumen API Error Handleing
<?php
/**
* Render an exception into an HTTP response.
*
* @param \Illuminate\Http\Request $request
* @param \Exception $exception
* @return \Illuminate\Http\Response
*/
public function render($request, Exception $exception)
{