Skip to content

Instantly share code, notes, and snippets.

View zQueal's full-sized avatar
🦍

Zach Queal zQueal

🦍
View GitHub Profile
@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);

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 / default
Created September 25, 2014 04:14
server {
listen 80 default_server;
root /usr/share/nginx/html;
index index.php index.html index.htm;
server_name web.dev; # FQDN
location / {
try_files $uri $uri/ =404;
}
@zQueal
zQueal / trash.sh
Last active August 29, 2015 14:06
A simple trash system for UNIX.
TRASH_DIR=~/.Trash # Set the Trash directory
mkdir -p "$TRASH_DIR" # Create it if it's not already created
trash() {
# list trash dir if no arguments given
if [[ -z $1 ]]; then
if _bash_trash_is_empty; then # call _bash_trash_is_empty function, then
echo "$TRASH_DIR: trash is empty" # return that the trash is empty
else
du -csh "$TRASH_DIR"/* # else list the contents of the trash directory

Keybase proof

I hereby claim:

  • I am zQueal 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 / ban.txt
Last active August 29, 2015 14:12
A list of IP addresses which have been attempting to gain access to a few of my dedicated servers.
219.141.254.244
181.39.37.190
162.244.30.181
142.4.38.36
70.38.63.166
50.57.64.185
222.255.174.84
195.154.164.81
201.234.7.10
192.3.159.181
@zQueal
zQueal / docx.php
Created July 27, 2015 07:56
Utilizes the zip extension (http://php.net/manual/en/book.zip.php) to access the document.xml file that holds the markup language for contents and formatting of a Word document.
<?php
/**
* Edit a Word 2007 and newer .docx file.
* Utilizes the zip extension http://php.net/manual/en/book.zip.php
* to access the document.xml file that holds the markup language for
* contents and formatting of a Word document.
*
* In this example we're replacing some token strings. Using
* the Office Open XML standard ( https://en.wikipedia.org/wiki/Office_Open_XML )
* you can add, modify, or remove content or structure of the document.