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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sudo find /home/forge/default/user/ -mindepth 1 -type f -mtime +7 | xargs rm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Remove all block comments and line comments: | |
(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/|[ \t]*//.*) | |
Remove block comments: | |
(/\*([^*]|[\r\n]|(\*+([^*/]|[\r\n])))*\*+/) | |
Remove line comments: | |
([ \t]*//.*) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import subprocess | |
import json | |
import os | |
from pathlib import Path | |
import requests | |
from requests.compat import urljoin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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()]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** get queue size **/ | |
Queue::size('queue-name'); | |
/** Count by name **/ | |
use Illuminate\Support\Facades\Redis; | |
// List all keys with status (awaiting, reserved, delayed) | |
Redis::keys('*'); | |
// Count by name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* global chrome, MediaRecorder, FileReader */ | |
chrome.runtime.onConnect.addListener(port => { | |
let recorder = null | |
port.onMessage.addListener(msg => { | |
console.log(msg); | |
switch (msg.type) { | |
case 'REC_STOP': | |
console.log('Stopping recording') | |
if (!port.recorderPlaying || !recorder) { |