Skip to content

Instantly share code, notes, and snippets.

View rana01645's full-sized avatar

Afjalur Rahman Rana rana01645

View GitHub Profile
#https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-18-04
#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
rana01645 / laravel can't read environment url
Created April 27, 2021 22:04
laravel can't read environment url
composer dump-autoload
php artisan cache:clear
php artisan config:clear
php artisan view:clear
@rana01645
rana01645 / delete 7 days older file from speicific folder linux
Created March 2, 2021 06:11
delete 7 days older file from speicific folder linux
sudo find /home/forge/default/user/ -mindepth 1 -type f -mtime +7 | xargs rm
@rana01645
rana01645 / remove_comment_regex.txt
Created December 13, 2020 07:31 — forked from natebass/remove_comment_regex.txt
Remove comments from file. Credit to Lambda's answer on Stack Overflow https://stackoverflow.com/a/2613945/5178499
Remove all block comments and line comments:
(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/|[ \t]*//.*)
Remove block comments:
(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/)
Remove line comments:
([ \t]*//.*)
# 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
@rana01645
rana01645 / gist:ea5350cfb6f966036f308f56c6e986d7
Created September 30, 2020 18:17
import db to remote mysql
DB_HOST=1.2.3.4
DB_PORT=3306
DB_DATABASE=db_name
DB_PASSWORD='password'
DB_USERNAME=username
pv -f db.sql | mysql -f -h ${DB_HOST} --port=${DB_PORT} -u${DB_USERNAME} -p${DB_PASSWORD} ${DB_DATABASE}
@rana01645
rana01645 / wgcf.py
Created July 22, 2020 20:55 — forked from oskar456/wgcf.py
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
rana01645 / laravel_csv_modifier.php
Created July 22, 2020 19:52
vel CSV spceific column modifier based on another file
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)
{
sudo mysql -u root
mysql> USE mysql;
mysql> UPDATE user SET plugin='mysql_native_password' WHERE User='root';
mysql> FLUSH PRIVILEGES;
mysql> exit;
service mysql restart
$action = AutomationAction::where('type','upload')->whereNull('started_at')->whereHasMorph( 'performer',['App\Video'], function ( $query) { $query->whereNotNull('uploaded_at'); })->update(['status'=>'success','started_at'=>now(),'finished_at'=>now()]);