Skip to content

Instantly share code, notes, and snippets.

View nhalstead's full-sized avatar
👨‍💻
Something. Maybe cool

Noah Halstead nhalstead

👨‍💻
Something. Maybe cool
View GitHub Profile
@nhalstead
nhalstead / Java Code Generator
Last active June 13, 2019 23:52
Using this you are able to generate some java code for `RobotMap.java`
<?php
/**
* $str will hold a value that is copied from Excel or Google Sheets.
* This will export Java code for RobotMap.java
*
* @author Noah Halstead <[email protected]>
*
*/
$str = <<<EOF
@nhalstead
nhalstead / truthy.js
Created June 13, 2019 03:05
Turn `"true"`. `"yes"`, `"1"` into a true or false value.
/**
* Truthy, Extends the Normal Truthy and makes it only true values.
* Normal Truthy will be true if the value is defined.
*
* @author Noah Halstead <[email protected]>
* @param {string|number|boolean} value Something the Evaluate for the "TRUE" value.
* @return boolean If the Value is a "TRUE" value.
*/
function truthy(value){
if (value === undefined) return false;
@nhalstead
nhalstead / AdvSearch.php
Last active June 13, 2019 03:57
Search Syntax Formulator
<?php
/**
* This allows for a Search Request to be Parsed to extract key
* values from it while leaving all other text within the request.
*
* @author Noah Halstead <[email protected]>
*/
$str = 'parent:11 student:344,234,22 status:paid Something Else to Search';
@nhalstead
nhalstead / pageconfig.js
Last active June 2, 2019 20:23
Config Manager in JS, This is used on things like YouTube music to keep a simple interface for config data.
const pagecfg = {
d: function() {
return pagecfg.data_ || (pagecfg.data_ = {});
},
get: function(k, o) {
return (k in pagecfg.d()) ? pagecfg.d()[k] : o;
},
set: function() {
var a = arguments;
if (a.length > 1) {
@nhalstead
nhalstead / AVGRemover-Cleanup.bat
Created December 31, 2018 06:22
This will Remove AVG from the Local Machine.
REM Cleanup
del /F /Q C:\Toolkit\*
@nhalstead
nhalstead / status_dhcp_leases_api.md
Last active March 15, 2019 12:47
PFSense DHCP Record JSON API Addon, Goto your Web Interface and Add the following content to add a JSON API to get all of the DHCP Records stored in the DHCP Server Service.

PFSense DHCP Record JSON API

  1. Goto http://[Router IP]/diag_edit.php and Paste /usr/local/www/status_dhcp_leases_api.php in the box of Path to file to be edited
  2. Paste Code
  3. Click Save
  4. Then goto http://[Router IP]/status_dhcp_leases_api.php

Done!

Keep in mind I have not added Authentication in this as it redirects to a Web Interface and does not return a standard 301 redirect, it just returns HTML.

@nhalstead
nhalstead / whitelist_domains.php
Last active January 16, 2019 16:15
This is to allows you to test domains to see if they match a url based rule list. This has "regex" matching in it to detect any subdomain `*.example.com` and block others using `!ebay.com`.
<?php
$authDomains = [
"google.com", // Allow
"*.google.com", // Allow [Any].google.com
"!webconsole.google.com", // Block
"club.hosting.com", // Allow
"webcome.go.google.com" // Allow
];
@nhalstead
nhalstead / expansion_pack.js
Last active June 8, 2019 23:18
This expansion pack adds some extra Functions that I tend to use in my programming, Works in Node and in Browser.
/**
* Adds some Capacity to run a foreach on an object
*
* @param {Function} Callback that will execute on every element
* @param {Mixed} Data to send to Every Call of the data
*/
Object.prototype.forEach = function(callback, extraData) {
Object.keys(this).forEach(function(key) {
var value = this[key];
callback(key, value, extraData);
@nhalstead
nhalstead / random.php
Created August 29, 2018 02:33
Random String Gen
<?php
/**
* Random String Gen
*
* @link https://stackoverflow.com/a/4356295/5779200
* @param int Length of the String
* @return string The Random String
*/
function generateRandomString($length = 10) {
@nhalstead
nhalstead / nginx.php
Created August 24, 2018 16:12
NGINX Status Page Parse
<?php
$NGINXStat = <<<EOF
Active connections: 32
server accepts handled requests
48932 48932 2594381
Reading: 2 Writing: 8 Waiting: 30
EOF;
$lines = explode("\n",$NGINXStat);