Skip to content

Instantly share code, notes, and snippets.


Afjalur Rahman Rana rana01645

View GitHub Profile
View laracasts-single-responsibility-after.php
namespace App\Acme;
use Carbon\Carbon;
// now, this class only gets the sales between the given dates.
// It doesn't deal with how with sales are stored, it doesn't
// deal with how to format the output, it doesn't deal with Auth
class SalesReporter
View early-stopping.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View gist:b14c6d3b9571779313911eab9a43040b
#install necessary libs
sudo apt update
sudo apt install python3-pip python3-dev libpq-dev nginx curl
#install mysql
sudo apt install mysql-server
sudo apt-get install libmysqlclient-dev
rana01645 / laravel can't read environment url
Created Apr 27, 2021
laravel can't read environment url
View laravel can't read environment url
composer dump-autoload
php artisan cache:clear
php artisan config:clear
php artisan view:clear
rana01645 / delete 7 days older file from speicific folder linux
Created Mar 2, 2021
delete 7 days older file from speicific folder linux
View delete 7 days older file from speicific folder linux
sudo find /home/forge/default/user/ -mindepth 1 -type f -mtime +7 | xargs rm
rana01645 / remove_comment_regex.txt
Created Dec 13, 2020 — forked from natebass/remove_comment_regex.txt
Remove comments from file. Credit to Lambda's answer on Stack Overflow
View remove_comment_regex.txt
Remove all block comments and line comments:
(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/|[ \t]*//.*)
Remove block comments:
Remove line comments:
([ \t]*//.*)
View gist:80e79abc355e4e25c2af71ac52c0f51d
# checkout to old_named branch
git checkout <old_name>
# create new named branch
git branch -m <new_name>
# push new named branch to remote
git push origin -u <new_name>
# delete old named branch
View gist:ea5350cfb6f966036f308f56c6e986d7
pv -f db.sql | mysql -f -h ${DB_HOST} --port=${DB_PORT} -u${DB_USERNAME} -p${DB_PASSWORD} ${DB_DATABASE}
rana01645 /
Created Jul 22, 2020 — forked from oskar456/
Cloudflare WARP linux client (using wg-quick for actual tunnel setup)
#!/usr/bin/env python3
import subprocess
import json
import os
from pathlib import Path
import requests
from requests.compat import urljoin
rana01645 / laravel_csv_modifier.php
Created Jul 22, 2020
vel CSV spceific column modifier based on another file
View laravel_csv_modifier.php
use Illuminate\Support\Collection;
function csvToArray($filename = '', $delimiter = ',')
if (!file_exists($filename) || !is_readable($filename))
return false;
$header = null;
$data = array();
if (($handle = fopen($filename, 'r')) !== false)