Skip to content

Instantly share code, notes, and snippets.

@lgalaz
lgalaz / gist:aec80abd40350161ff63
Last active July 12, 2022 02:18
Server sent events with Laravel
Using nginx version: nginx/1.6.2 and Laravel 5
In the controller:
use Symfony\Component\HttpFoundation\StreamedResponse;
- - - - - - Some method - - - - - - - - -
$response = new StreamedResponse();
$response->headers->set('Content-Type', 'text/event-stream');
$response->headers->set('Cache-Control', 'no-cache');
$response->setCallback(
function() {
@lgalaz
lgalaz / gist:c782c30f27af7a9cca68
Created February 21, 2015 23:41
Vagrant alias to start vm and up it if its halted.
bash:
function coolness() {
ssh -q [email protected] -p 2222;
ret=$?;
if [ $ret -eq 255 ]; then
cd ~/Public/Homestead/;
vagrant up;
sudo apt-get install zsh -y
git clone git://github.com/robbyrussell/oh-my-zsh.git /home/vagrant/.oh-my-zsh
cp /home/vagrant/.oh-my-zsh/templates/zshrc.zsh-template /home/vagrant/.zshrc
sudo chsh -s /usr/bin/zsh vagrant
sed -i 's/robbyrussell/afowler/g' /home/vagrant/.zshrc
@lgalaz
lgalaz / gist:3e629f250f1c0b04c211
Last active September 14, 2017 22:25
Laravel after.sh
#!/bin/sh
# If you would like to do some extra provisioning you may
# add any commands you wish to this file and they will
# be run after the Homestead machine is provisioned.
# Update app-get
sudo apt-get update
@lgalaz
lgalaz / Change Mysql root password
Created December 11, 2017 22:29
Change Mysql root password
$ sudo service mysql start
$ cd /var/run
--// Back the sock
$ sudo cp -rp ./mysqld ./mysqld.bak
$ sudo service mysql stop
Activating mysql logs to see what tables are being used is very helpful when reverse engineering something.
To find your log location run the following
```
SHOW VARIABLES LIKE '%general_log%';
SHOW VARIABLES LIKE '%slow_query_log%';
```
If logs appear off you can turn on with: