Skip to content

Instantly share code, notes, and snippets.

<?php
function validateURL($url)
{
if (filter_var($url, FILTER_VALIDATE_URL) !== false) {
// Parse the URL to get its components
$parsedUrl = parse_url($url);
// Check the scheme
if (in_array($parsedUrl['scheme'], ['http', 'https'])) {
@nekhbet
nekhbet / gist:2714526d7441ae1eaa2fb530aa1fab9f
Created November 14, 2016 03:57
Modify (Increase) TX power on ALFA AWUS036NEH
ifconfig wlan0 down
iw reg set GY
ifconfig wlan0 up
@nekhbet
nekhbet / closeConnection.php
Created October 1, 2016 18:45 — forked from bubba-h57/closeConnection.php
Easy way to close connections to the browser and continue processing on the server.
<?php
/**
* Close the connection to the browser but continue processing the operation
* @param $body
*/
public function closeConnection($body, $responseCode){
// Cause we are clever and don't want the rest of the script to be bound by a timeout.
// Set to zero so no time limit is imposed from here on out.
set_time_limit(0);
@nekhbet
nekhbet / optimize.sh
Last active August 29, 2015 14:14 — forked from Mad182/optimize.sh
#!/bin/bash
optimize() {
jpegoptim *.jpg --strip-all
optipng *.png
for i in *
do
if test -d $i
then
cd $i
echo $i