Skip to content

Instantly share code, notes, and snippets.

View zachflower's full-sized avatar
💾

Zachary Flower zachflower

💾
View GitHub Profile
@zachflower
zachflower / tor_curl.php
Last active March 15, 2024 15:02
How To Anonymize PHP cURL Requests Using Tor
<?php
$ip = '127.0.0.1';
$port = '9051';
$auth = 'PASSWORD';
$command = 'signal NEWNYM';
$fp = fsockopen($ip,$port,$error_number,$err_string,10);
if(!$fp) { echo "ERROR: $error_number : $err_string";
return false;
@zachflower
zachflower / rainbow.cpp
Last active February 19, 2024 09:34
Smooth RGB LED Color Transitions (Arduino)
int redPin = 11;
int greenPin = 10;
int bluePin = 9;
int r = 0;
int g = 0;
int b = 0;
void setup() {
pinMode(redPin, OUTPUT);
@zachflower
zachflower / LinkedList.class.php
Last active April 15, 2021 18:33
PHP implementation of a singly linked list.
<?php
class Node {
public $data = NULL;
public $next = NULL;
public function __construct($data = NULL) {
$this->data = $data;
}
}
class Hello
def self.world
puts "Hello, world!"
end
end
@zachflower
zachflower / Vagrantfile
Created October 6, 2017 21:30
Standard Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# bring in the vagrant dependency manager
require File.dirname(__FILE__) + "/dependency_manager"
# make sure the following plugins are installed (managed using dependency manager above)
check_plugins ["vagrant-exec", "vagrant-hostmanager", "vagrant-triggers"]
Vagrant.configure(2) do |config|
void log_event( const char* title, const char* level, const char* message ) {
char *payload;
char url[MAX_STRING_LENGTH];
json_t *obj = json_array();
json_t *event = json_object();
json_t *data = json_object();
if ( NETUITIVE_USERNAME != NULL && NETUITIVE_PASSWORD != NULL ) {
json_object_set_new(event, "title", json_string( title ));
void curl_json_push(const char* url, const char* payload, const char* method, const char* username, const char* password) {
pid_t pid;
curl_global_init(CURL_GLOBAL_ALL);
pid = fork();
if ( pid == 0 ) {
CURL *curl;
struct curl_slist *headers = NULL;
@zachflower
zachflower / kubernetes-deploy.sh
Created October 6, 2016 20:06
Codeship Kubernetes Deploy
#!/bin/bash
set -e
# authenticate to google cloud
codeship_google authenticate
# set compute zone
gcloud config set compute/zone us-central1-a
@zachflower
zachflower / codeship-steps.yml
Created August 24, 2016 06:22
Codeship Steps w/ Deploy
- type: serial
steps:
- type: serial
steps:
- service: build
command: composer install --prefer-source --no-interaction
- type: parallel
steps:
- service: test
command: vendor/bin/phpunit tests/Auth/
@zachflower
zachflower / codeship-steps.yml
Last active September 29, 2016 18:12
Codeship Parallel Tests
- type: parallel
steps:
- service: app
command: vendor/bin/phpunit tests/Auth/
- service: app
command: vendor/bin/phpunit tests/Broadcasting/
- service: app
command: vendor/bin/phpunit tests/Bus/
- service: app
command: vendor/bin/phpunit tests/Cache/