Skip to content

Instantly share code, notes, and snippets.

View musaid's full-sized avatar
🏠
Working from home

musaid musaid

🏠
Working from home
View GitHub Profile
@musaid
musaid / postgres_queries_and_commands.sql
Created August 13, 2023 02:42 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@musaid
musaid / ExampleNotification.php
Created April 24, 2020 04:07 — forked from alejandrogih/ExampleNotification.php
Send email with Sendgrid (including template id and substitutions) with Laravel's notifications
<?php
namespace App\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
//This example use the official's sendgrid php helper (https://github.com/sendgrid/sendgrid-php)
@musaid
musaid / config.js
Last active October 31, 2018 10:34 — forked from 1Marc/config.js
My VS Code Config
// For: @musaid
// https://twitter.com/musaid/status/1039688749205020672
// Ligatures built into Operator Mono as "Operator Mono Lig" with https://github.com/kiliman/operator-mono-lig
// VS Code Extensions:
// Material Icon Theme (Philip Kief),
// indent-rainbow (oderwat),
// Rainbow Brackets (2gua),
// Subtle Match Brackets (Rafa Mel),
// Git Lense
// Prettier (Esben Petersen) (require config file with requireConfig)
@musaid
musaid / cors-test.sh
Created January 12, 2018 12:18 — forked from skounis/cors-test.sh
Test CORS headers with curl
#!/bin/bash
curl -X GET -H "Origin: http://example.com" --verbose http://foo.com/bar
curl -X POST -H "Origin: http://example.com" --verbose http://foo.com/bar
curl -X PUT -H "Origin: http://example.com" --verbose http://foo.com/bar
@musaid
musaid / laravel-subdirectory.conf
Created February 8, 2017 03:29 — forked from tsolar/laravel-subdirectory.conf
Laravel in subdirectory nginx example
server {
client_body_in_file_only clean;
client_body_buffer_size 32K;
client_max_body_size 300M;
sendfile on;
send_timeout 300s;
# Port that the web server will listen on.
#listen 80;
@musaid
musaid / install-comodo-ssl-cert-for-nginx.rst
Created May 5, 2016 06:43 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@musaid
musaid / gist:59c64e3c4e86eb0f3bfa
Last active August 29, 2015 14:27 — forked from maciakl/gist:4531580
Adding Ubuntu PPA repository behind a firewall. When you are behind a corporate firewall that only allows outbound traffic on ports 80 and 433 the usual apt-add-repository command will not work. To get around it. Here is the workaround.
# trying to install PPA behind firewall fails:
$ sudo add-apt-repository ppa:chris-lea/node.js
gpg: requesting key C7917B12 from hkp server keyserver.ubuntu.com
gpgkeys: HTTP fetch error 7: couldn't connect to host
gpg: no valid OpenPGP data found.
gpg: Total number processed: 0
recv failed
# this is how you get around it (use the key from the command above)
$ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys C7917B12
@musaid
musaid / nginx.conf
Last active August 29, 2015 14:27 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
server {
# Listen on port 80 for any IPv4 address on this server
# listen docs: http://wiki.nginx.org/HttpCoreModule#listen
listen 80;
# Listen on only the selected hostname...
server_name <HOSTNAME>;
# ...or use the catchall character if you want to handle multiple hostnames
# server_name _;
@musaid
musaid / jed.cnf
Last active August 29, 2015 14:16 — forked from jedprentice/jed.cnf
[mysqld]
# Slow Log
#slow_query_log = 1
#log_queries_not_using_indexes = 1
#long_query_time = 1
# Disable DNS lookups for performance
skip_name_resolve
# MySQL >= 5.5.5 uses InnoDB by default, but set it just in case