Skip to content

Instantly share code, notes, and snippets.

Avatar
🤙
Being awesome

Rob Janssen RobThree

🤙
Being awesome
View GitHub Profile
@RobThree
RobThree / wavefilereader.class.php
Created Aug 29, 2012
PHP WAVE file reader / parser
View wavefilereader.class.php
<?php
/**
* WaveFileReader; a simple class to read/parse WAVE file
* (c)2012 Rob Janssen / https://github.com/RobThree
*
* Based on https://ccrma.stanford.edu/courses/422/projects/WaveFormat/
*
* USAGE:
*
* $wav = WaveFileReader::ReadFile('/path/to/test.wav');
@RobThree
RobThree / SoapClientEx.class.php
Created Nov 20, 2012
PHP SoapClient with timeout and authentication
View SoapClientEx.class.php
<?php
//**NOTE**: This has *NOT* been tested yet; please provide feedback in the comments
//Drop-in replacement for PHP's SoapClient class supporting connect and response/transfer timeout and authentication
//Usage: Exactly as PHP's SoapClient class, except that some new options are available:
// timeout The response/transfer timeout in milliseconds; 0 == default SoapClient / CURL timeout
// connecttimeout The connection timeout; 0 == default SoapClient / CURL timeout
// sslverifypeer FALSE to stop SoapClient from verifying the peer's certificate
// sslversion The SSL version (2 or 3) to use. By default PHP will try to determine this itself, although in some cases this must be set manually
// sslverifyhost 1 to check the existence of a common name in the SSL peer certificate. 2 to check the existence of a common name and also verify that
@RobThree
RobThree / check.cs
Last active Jul 6, 2020
C# implementation of the FNV-1 and FNV-1a hashes (http://www.isthe.com/chongo/tech/comp/fnv/)
View check.cs
// Test/check FNV-1(a) hash implementations
var testvectors = new[] { "", "a", "b", "c", "d", "e", "f", "fo", "foo", "foob", "fooba", "foobar", "\0", "a\0", "b\0", "c\0", "d\0", "e\0", "f\0", "fo\0", "foo\0", "foob\0", "fooba\0", "foobar\0", "ch", "cho", "chon", "chong", "chongo", "chongo ", "chongo w", "chongo wa", "chongo was", "chongo was ", "chongo was h", "chongo was he", "chongo was her", "chongo was here", "chongo was here!", "chongo was here!\n", "ch\0", "cho\0", "chon\0", "chong\0", "chongo\0", "chongo \0", "chongo w\0", "chongo wa\0", "chongo was\0", "chongo was \0", "chongo was h\0", "chongo was he\0", "chongo was her\0", "chongo was here\0", "chongo was here!\0", "chongo was here!\n\0", "cu", "cur", "curd", "curds", "curds ", "curds a", "curds an", "curds and", "curds and ", "curds and w", "curds and wh", "curds and whe", "curds and whey", "curds and whey\n", "cu\0", "cur\0", "curd\0", "curds\0", "curds \0", "curds a\0", "curds an\0", "curds and\0", "curds and \0", "curds and w\0", "curds and wh\0
@RobThree
RobThree / SoapClientTimeout.class.php
Created Apr 25, 2012
PHP SoapClient with timeout
View SoapClientTimeout.class.php
<?php
//Drop-in replacement for PHP's SoapClient class supporting connect and response/transfer timeout
//Usage: Exactly as PHP's SoapClient class, except that 3 new options are available:
// timeout The response/transfer timeout in milliseconds; 0 == default SoapClient / CURL timeout
// connecttimeout The connection timeout; 0 == default SoapClient / CURL timeout
// sslverifypeer FALSE to stop SoapClient from verifying the peer's certificate
class SoapClientTimeout extends SoapClient
{
private $timeout = 0;
private $connecttimeout = 0;
@RobThree
RobThree / ratelimiter.php
Last active Dec 16, 2019
Simple, rude, rate limiter (using memcache).
View ratelimiter.php
<?php
/* Very simple, crude, rate limiter */
/*
Assumes _MEMCACHEDSITEPREFIX, _MEMCACHEDHOST and _MEMCACHEDPORT are `defined`:
define('_MEMCACHEDHOST', '127.0.0.1');
define('_MEMCACHEDPORT', 11211);
define('_MEMCACHEDSITEPREFIX', 'mysite');
*/
View DecimalValue.cs
using System.Linq;
namespace YOUR_NAMESPACE_HERE
{
public partial class DecimalValue
{
public DecimalValue(int[] bits) => Bits.AddRange(bits);
public static implicit operator decimal(DecimalValue decimalValue) => decimalValue.ToDecimal();
@RobThree
RobThree / gist:b7ee02338024beb7a2fbfd14e9a060b2
Last active Sep 24, 2019
My AdBlock Plus custom filters
View gist:b7ee02338024beb7a2fbfd14e9a060b2
aliexpress.com###J_xiaomi_dialog
9gag.com###overlay-container
9gag.com###sidebar
9gag.com##.badge-sticky-button
9gag.com##.post-meta
9gag.com##.share
flabber.nl###footer
flabber.nl##.block-block
flabber.nl##.carousel
flabber.nl##.news-box
@RobThree
RobThree / custom.css
Last active May 29, 2019
Maak je Tweakers.net frontpage weer bruikbaar
View custom.css
/* Automatisch spoilers tonen bij hover */
div.spoiler:hover {
color: white !important;
}
/* Quotes donkerder dan posts */
.message-quote-div {
background-color: #dddede !important;
border: 1px solid #c8c8c8 !important;
color: #000 !important;
View gist:6a0ed026a4b9bbd2f488fdf7e7841c3e
Verifying my Blockstack ID is secured with the address 1LF6MBuM2XTJxAoqCWBHo59ZqQ5EXUaBKs https://explorer.blockstack.org/address/1LF6MBuM2XTJxAoqCWBHo59ZqQ5EXUaBKs
You can’t perform that action at this time.