Skip to content

Instantly share code, notes, and snippets.

View zQueal's full-sized avatar
🦍

Zach Queal zQueal

🦍
View GitHub Profile
@zQueal
zQueal / scrape.rb
Created June 20, 2013 16:44
Scrape information from a page.
require 'rio'
require 'open-uri'
require 'uri'
unless ARGV[0] and ARGV[1]
puts "You must specify an operation and URL."
puts "USAGE: scrape.rb [page|images|links] <http://www.some_site.com>"
exit
end
@zQueal
zQueal / index.php
Created July 1, 2013 07:31
Simple bitcoin shortening API. Requires Flight: https://github.com/Xanza/flight
<?php
# Includes #
require_once('flight/Flight.php');
# Database Information #
Flight::register('db', 'PDO', array('mysql:host=localhost;port=3306;dbname=btc', 'root', 'password'), function($db) {
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
});
@zQueal
zQueal / awesome-php.md
Last active December 16, 2019 18:39 — forked from ziadoz/awesome-php.md
@zQueal
zQueal / btc.php
Created February 5, 2014 03:24
Uses cURL to pull the current price of BTC in USD.
#!/usr/bin/env php
<?php
$c = curl_init();
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($c, CURLOPT_HTTPHEADER, array('Accept: application/json', 'Content-Type: application/json'));
curl_setopt($c, CURLOPT_URL, 'http://data.mtgox.com/api/2/BTCUSD/money/ticker');
$data = curl_exec($c);
curl_close($c);
@zQueal
zQueal / .htrouter
Created May 12, 2014 22:41
bcrypt() proof of concept
<?php
if(!file_exists(__DIR__ . '/' . $_SERVER['REQUEST_URI'])){
$_GET['_url'] = $_SERVER['REQUEST_URI'];
}
return false;

Keybase proof

I hereby claim:

  • I am xanza on github.
  • I am zqueal (https://keybase.io/zqueal) on keybase.
  • I have a public key whose fingerprint is 7B5A C030 0E2C 74FD 355C CC81 B1DA 56DC B73E 8516

To claim this, I am signing this object:

@zQueal
zQueal / juicecalc.pl
Created June 26, 2014 00:23
Calculate eJuice recipes from CLI. Made By: http://www.reddit.com/user/j_hornsties
#!/usr/bin/perl -w
# Caclulate Volumes for ejuice
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@zQueal
zQueal / dns.php
Created July 25, 2014 23:49
Return DNS records for a domain.
#!/usr/bin/env php
<?php
class DNS {
public function __construct() {
$q = $_SERVER['argv'];
if(isset($q[1])) {
$lookup = dns_get_record($q[1], DNS_ALL - DNS_PTR);
echo json_encode($lookup);
} else {
@zQueal
zQueal / clip.md
Created August 3, 2014 07:12
Handy script to help make xclip really simple.
#!/bin/bash
if [[ -t 0  && -z "$1" ]]; then 
    # output contents of clipboard
    xclip -out -selection clipboard || exit 1
elif [[ -n "$1" ]]; then
    # copy file contents to clipboard
    xclip -in -selection clipboard < "$1" || exit 1
else
    # copy stdin to clipboard

xclip -in -selection clipboard <&0 || exit 1

@zQueal
zQueal / README.md
Last active August 31, 2015 05:54
How to Setup WordPress in Ubuntu 14.04 Using a Remote MySQL Server

About

For this instructional tutorial we'll be exploring the installation and setup of both WordPress v4.0 and the required MySQL database used to support it. However, sometimes we find ourselves in interesting situations which either necessitate or involve remote instances of a MySQL server or database. Quite simply, most of the time remote databases or servers are used for security purposes--specifically security through obscurity and not having all of your eggs in a single basket.

Important: Please ensure that you are correctly modifying usernames, passwords, hostnames and IP addresses to suit your needs. If you do not, this setup will not work correctly for you.

The Setup—LEMP

LEMP (Linux, Nginx, MySQL, PHP) is one of the most stable and widely used production/development environments available to developers. Anything Apache can do, Nginx can do much faster. This includes PHP proc