Skip to content

Instantly share code, notes, and snippets.

View stungeye's full-sized avatar

Kyle Geske stungeye

View GitHub Profile
@stungeye
stungeye / auth.php
Created July 28, 2012 19:01
Simple HTTP Authentication in PHP using HTTP AUTH Headers
<?php
define('ADMIN_LOGIN','wally');
define('ADMIN_PASSWORD','mypass'); // Could be hashed too.
if (!isset($_SERVER['PHP_AUTH_USER']) || !isset($_SERVER['PHP_AUTH_PW'])
|| ($_SERVER['PHP_AUTH_USER'] != ADMIN_LOGIN)
|| ($_SERVER['PHP_AUTH_PW'] != ADMIN_PASSWORD)) {
header('HTTP/1.1 401 Unauthorized');
header('WWW-Authenticate: Basic realm="Password For Blog"');
exit("Access Denied: Username and password required.");
@stungeye
stungeye / main.cpp
Last active February 28, 2023 15:55
Base and Derived Types in C++ with Polymorphic Functions and Collections using Pointers
#include <iostream> // std::cout
#include <string> // std::string
#include <vector> // std::vector
#include <memory> // std::unique_ptr, std::make_unique
class Animal {
// Base Class - Eventually Abstract
std::string name;
protected:
@stungeye
stungeye / main_with_pointer.cpp
Last active February 13, 2023 18:23
Has-As Class Relationship with and without Pointers
/*
Imagine this code was written before initializer lists. (Pre C++11)
When compared with `main_without_pointer_oldskool_and_broken.cpp`:
- Point's location member is a pointer to a Location.
- Location does not need a default constructor.
- The location member is only constructed once.
*/
#include <iostream>
@stungeye
stungeye / main.cpp
Last active February 13, 2023 17:40
Base and Derived CPP Classes
#include <iostream>
class Base {
protected:
int value; // Derived class will have access.
public:
Base(int value) : value{value} {
std::cout << "Base Constructor\n";
}
@stungeye
stungeye / ofApp.cpp
Created February 2, 2023 21:30
Detecting Keys and Keycodes in Openframeworks
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup() {
ofAddListener(ofGetWindowPtr()->events().keyPressed, this,
&ofApp::keycodePressed);
}
//--------------------------------------------------------------
void ofApp::update(){
@stungeye
stungeye / before_and_after_boxstarter.md
Last active January 31, 2023 21:48
Boxstarter Windows 10 Developer Setup - 2021 Edition

Enable Windows Developer Mode

Open the Windows Settings app, search for Developer Mode and enable it.

Install Boxstarter

Run Powershell as Admin and execute:

Set-ExecutionPolicy Unrestricted -Force

. { iwr -useb https://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force

@stungeye
stungeye / words.h
Last active January 23, 2023 15:29
A Words - Word List
#pragma once
#include <string>
#include <vector>
const std::vector<std::string> words{
"abominates", "abominating", "abomination", "abominations", "abominator", "abominators", "abomine", "abondance",
"abongo", "abonne", "abonnement", "aboon", "aborad", "aboral", "aborally", "abord", "aboriginal", "aboriginality",
"aboriginally", "aboriginals", "aboriginary", "aborigine", "aborigines", "aborning", "aborsement", "aborsive",
"abort", "aborted", "aborter", "aborters", "aborticide", "abortient", "abortifacient", "abortin", "aborting",
"abortion", "abortional", "abortionist", "abortionists", "abortions", "abortive", "abortively", "abortiveness",
@stungeye
stungeye / 01_flickr_to_google_with_exiftool.md
Last active November 25, 2022 10:15
Export Flickr Photos To Google Photos Using Exiftool CLI

Backing Up All Photos from Flickr to Google Photos

  • Request an archive of your photos and metadata (json) from the "Your Flickr Data" section of your Flickr user account page.

  • Extract all provided zip files to a single folder with the JSON files unzip to a json subfolder.

  • Install exiftool, a command-line application for reading, writing and editing meta information in a wide variety of files..

  • Sort your Flickr photos into yearly folders by EXIF timestamp and set file-system timestamps from the command line:

@stungeye
stungeye / .gitignore
Created November 15, 2022 16:29
A .gitignore File for openFrameworks Projects Which Correctly Allows Required Files in the bin and bin/data Folders
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
##
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
# User-specific files
*.rsuser
*.suo
*.user
*.userosscache
@stungeye
stungeye / ofApp.cpp
Created October 27, 2022 22:00
Collision Detection Using openFrameworks and ofRectangle
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup() {
}
//--------------------------------------------------------------
void ofApp::update() {
a2.update({static_cast<float>(ofGetMouseX()), static_cast<float>(ofGetMouseY())});
}