Skip to content

Instantly share code, notes, and snippets.

View fermino's full-sized avatar

Fermín Olaiz fermino

View GitHub Profile
@ircmaxell
ircmaxell / Expressions.php
Created September 21, 2011 16:51
A math parser and evaluator implementation
<?php
class Parenthesis extends TerminalExpression {
protected $precidence = 6;
public function operate(Stack $stack) {
}
public function getPrecidence() {
return $this->precidence;
/* fix_fft.c - Fixed-point in-place Fast Fourier Transform */
/*
All data are fixed-point short integers, in which -32768
to +32768 represent -1.0 to +1.0 respectively. Integer
arithmetic is used for speed, instead of the more natural
floating-point.
For the forward FFT (time -> freq), fixed scaling is
performed to prevent arithmetic overflow, and to map a 0dB
sine/cosine wave (i.e. amplitude = 32767) to two -6dB freq
@akDeveloper
akDeveloper / class_constants.php
Created November 13, 2012 13:09
PHP override class constants
<?php
class Foo
{
const TEST = 'foo';
public static function getConst()
{
return static::TEST;
}
@extraordinaire
extraordinaire / reconnecting_pdo.php
Last active June 27, 2023 11:12
Reconnectable PDO
<?php
class ReconnectingPDO
{
protected $dsn, $username, $password, $pdo, $driver_options;
public function __construct($dsn, $username = "", $password = "", $driver_options = array())
{
$this->dsn = $dsn;
$this->username = $username;
$this->password = $password;
@Nilpo
Nilpo / Session.php
Last active August 5, 2023 16:48
A simple session wrapper class to provide static OOP access to PHP sessions.
<?php
/**
* Session Helper Class
*
* A simple session wrapper class.
*
* Recommended for use with PHP 5.4.0 or higher. (Not required.)
*
* Usage Example:
@robot56
robot56 / gist:8499806
Created January 19, 2014 02:45
PCI information, sorted by Vendor IDs.
This file has been truncated, but you can view the full file.
{
"0x0033": {
"0x002F": {
"Vendor Name": "Paradyne Corp.",
"Device Name": "ieee 1394 controller"
},
"0x00333": {
"Vendor Name": "Paradyne Corp.",
"Device Name": "1ACPI\\GenuineIntel_-_x86_Family_6_Model_23\\_0"
}
@milo
milo / github-webhook-handler.php
Last active July 26, 2023 15:29
GitHub Webhook Handler
<?php
/**
* GitHub webhook handler template.
*
* @see https://docs.github.com/webhooks/
* @author Miloslav Hůla (https://github.com/milo)
*/
$hookSecret = 's.e.c.r.e.t'; # set NULL to disable check
@nostah
nostah / gist:d610459d50564c729c56
Created April 13, 2015 07:42
php swagger 2.0 api sample
<?php
use Swagger\Annotations as SWG;
/**
* @SWG\Swagger(
* basePath="/v1",
* host="api.local",
* schemes={"http"},
* produces={"application/json"},
@ha7ilm
ha7ilm / openwebrx-quick-setup.sh
Last active February 3, 2022 22:13
Setting up OpenWebRX on Ubuntu 14.04 LTS
#Install dependencies
sudo apt-get install build-essential git libfftw3-dev cmake libusb-1.0-0-dev
#Fetch and build rtl-sdr, skip if already done (subdirectories will be created under the current directory).
git clone git://git.osmocom.org/rtl-sdr.git
cd rtl-sdr/
mkdir build
cd build
cmake ../ -DINSTALL_UDEV_RULES=ON
make
@alekswn
alekswn / adb_rotate.sh
Created January 22, 2016 23:41
Android: screen rotation from ADB
#!/bin/sh
if [ -z $1 ]
then
echo "Usage: $0 { p | l | a }. p - portrait, l - landscape, a - auto"
elif [[ $1 == a* ]]
then
echo "Turning on automatic rotation"
adb shell content insert --uri content://settings/system --bind name:s:accelerometer_rotation --bind value:i:1
else