Skip to content

Instantly share code, notes, and snippets.

@CodeAngry
CodeAngry / sqlpackage_msi.ps1
Created May 29, 2020 03:31
Update SQLPackage via Powershell and MSI
# wait before exiting script or force update?
# .\script.ps1 -force 0 -wait 1
param ([bool] $wait = $false, [bool] $force = $false)
$global:ErrorActionPreference = 'SilentlyContinue'
$global:ProgressPreference = 'SilentlyContinue'
Clear-Host
Write-Host "**************************************************************"
@CodeAngry
CodeAngry / GetHeadersCUrl.php
Created October 4, 2012 19:01
Alternative to get_headers with cURL and more bling.
<?php
/**
* Does a cURL request against a URL and returns only the Headers.
* If redirections occur, all Headers are returned for each Hop.
*
* By default, if not false, returned value is an array of arrays.
* If $associative is true, each set of Headers will be decoded into an associative array.
* If $only_last is true, regardless of the sets of Headers returned, only the last is kept.
*
* <code>
@CodeAngry
CodeAngry / Verify_PayPal_IPN.php
Last active December 17, 2020 11:02
Verify PayPal IPN with PHP & cURL. Works for both Live and Sandbox IPNs.
<?php
/**
* Verifies a PayPal Live/Sandbox IPN.
*
* It returns NULL if freak error occurs (no connection, bad reply, bad IPN).
* It returns BOOL to signal verification success or failure.
*
* @author Claude "CodeAngry" Adrian
*
* @param array/null $IPN
@CodeAngry
CodeAngry / PayPalAPI_DoDirectPayment.php
Created June 30, 2012 20:26
PaypalAPI DoDirectPayment Sale PHP Implementation :: Untested, wrote at anger! :)
<?php
// ------------------------------------------------------------------------------------------ //
/**
* LICENSE: Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
@CodeAngry
CodeAngry / namespacelessxml.php
Created August 18, 2012 20:10
Load XML into SimpleXMLElement without Namespaces.
<?php
/**
* Loads XML and kills namespaces in the process.
* It allows easy usage of namespaced XML code.
*
* - NameSpaced tags are renamed from <ns:tag to <ns_tag.
* - NameSpaced tags are renamed from </ns:tag> to </ns_tag>.
* - NameSpaced attributes are renamed from ns:tag=... to ns_tag=....
*
* @license http://sam.zoy.org/wtfpl/
@CodeAngry
CodeAngry / WpWideAdminMenu.php
Last active December 22, 2015 20:59
WordPress standalone plugin to make the admin menu wider.
<?php
/*
Plugin Name: Wider Admin Menu
Plugin URI: https://github.com/5ubliminal/WordPress-Wider-Admin-Menu
Description: Changes the WordPress admin menu width to <code>apply_filters('admin_menu_width', 200);</code>.
Version: 0.0.7
Author: Claude "CodeAngry" Adrian
Author URI: http://codeangry.com/
License: WTFPL
*/
@CodeAngry
CodeAngry / get_file_size.cpp
Created August 4, 2013 05:41
Three methods to get the file size of a path in Windows C++.
/// <summary>Values that represent the methods available to get the file size.</summary>
/// <remarks>Claude "CodeAngry" Adrian, 20 May 2012.</remarks>
typedef enum class file_size_methods {
create_file = 1, // CreateFile, GetFileSizeEx, CloseHandle (II speed, I reliable)
get_attributes = 2, // GetFileAttributesEx (I speed)
find_file = 3, // FindFirstFile, FindClose (III speed)
} file_size_method;
/// <summary>Gets athe file size using the chosen method.</summary>
/// <remarks>Claude "CodeAngry" Adrian, 20 May 2012.</remarks>
<?php
/**
* The right way to do a SEO HTTP Redirection. (says me)
*
* @copyright Claude "CodeAngry" Adrian
* @link http://codeangry.com/
* @license WTFPL
*/
namespace CA;
@CodeAngry
CodeAngry / CPU_Maker_Model.cpp
Last active August 29, 2015 14:02
Get CPU Maker and Model.
//
// Written and Tested in VC++ (C++11 code)
// by @CodeAngry
//
// get the maker name
int vCpuBuffer[4]{};
__cpuid(vCpuBuffer, 0);
unsigned int vHighestFeature((unsigned int)vCpuBuffer[0]);
char vCpuMaker[32]{}; // zero-fill
@CodeAngry
CodeAngry / CookieMonster.js
Last active August 29, 2015 13:57
Cookie Monster is a simple JS cookie manager.
/**
* CookieMonster.JS
*
* @copyright Claude Adrian, CodeAngry
* @license http://www.wtfpl.net/
*/
;(function(){
if (typeof String.prototype.trimLeft !== 'function') {
String.prototype.trimLeft = function() {