Skip to content

Instantly share code, notes, and snippets.

View JeremyDunn's full-sized avatar

Jeremy Dunn JeremyDunn

  • 21:13 (UTC -05:00)
View GitHub Profile

Screen Quick Reference

Basic

Description Command
Start a new session with session name screen -S <session_name>
List running sessions / screens screen -ls
Attach to a running session screen -x
Attach to a running session with name screen -r
@JeremyDunn
JeremyDunn / gist:08bc7812991d25a9e8f77a9614286159
Created August 9, 2018 19:52 — forked from nickdavis/gist:10525079
.htaccess 301 redirect local WordPress dev site images folder to live website images folder (to save fllling up local drive with 1000's of unnecessary images)
#301 Redirect Local Images to Live
RedirectMatch 301 ^/wp-content/uploads/(.*) http://livewebsite.com/wp-content/uploads/$1
@JeremyDunn
JeremyDunn / YourCommand.php
Created February 8, 2018 14:23
Show download progress in Symfony / Laravel Console Command
<?php
protected function execute(InputInterface $input, OutputInterface $output)
{
$progress = $this->getHelperSet()->get('progress');
$ctx = stream_context_create(array(), array('notification' => function ($notification_code, $severity, $message, $message_code, $bytes_transferred, $bytes_max) use ($output, $progress) {
switch ($notification_code) {
case STREAM_NOTIFY_FILE_SIZE_IS:
$progress->start($output, $bytes_max);
break;
@JeremyDunn
JeremyDunn / bindRawSql.php
Last active May 9, 2017 14:11
Function to return Illuminate Query Builder SQL with bindings as raw SQL
<?php
$bindRawSql = function (\Illuminate\Database\Query\Builder $q) {
$sql = $q->toSql();
foreach ($q->getBindings() as $binding) {
$binding = (is_numeric($binding)) ? $binding : "'$binding'";
$sql = substr_replace($sql, $binding, stripos($sql, '?'), 1);
}
return $sql;
};