Skip to content

Instantly share code, notes, and snippets.

View bordeux's full-sized avatar

Chris Bednarczyk bordeux

View GitHub Profile
ASCII code w.conditionNum Hexadecimal value Weather conditions
120 31 32 30 Sunny
101 31 30 31 Heavy rain
102 31 30 32 Thunderstorm
103 31 30 33 Sandstorm
104 31 30 34 Light snow
105 31 30 35 Snow
106 31 30 36 Freezing fog
107 31 30 37 Rainstorm
@bordeux
bordeux / int96_to_date.js
Created September 23, 2022 16:40
Convert INT96 TimeStamp to Date object in NodeJS/JavaScript
const int96ToDate = value => {
const linuxEpoch = 2_440_588;
const bigInt = BigInt(value);
const julianCalendarDays = Number(bigInt >> BigInt(8 * 8));
const time = Number(
BigInt(bigInt & BigInt('0xFFFFFFFFFFFFFFFF')) / BigInt(1_000_000)
);
const date = new Date();
date.setUTCFullYear(1970, 0, 1);
<?xml version="1.0"?>
<ruleset name="TourRadar">
<rule ref="PSR1" />
<rule ref="PSR2" />
<rule ref="PSR12" />
<rule ref="Generic.PHP.ForbiddenFunctions">
<properties>
<property name="forbiddenFunctions" type="array" value="sizeof=>count,delete=>unset,print=>null,echo=>null,is_null=>null,create_function=>null,var_dump=>null,eval=>null"/>
@bordeux
bordeux / Country-to-currency.php
Created April 25, 2018 12:01
Country ISO to currency
<?php
return [
'AF' => 'AFN',
'AL' => 'ALL',
'DZ' => 'DZD',
'AS' => 'USD',
'AD' => 'EUR',
'AO' => 'AOA',
'AI' => 'XCD',
'AQ' => 'XCD',
@bordeux
bordeux / returntrue.win
Last active February 20, 2018 18:21
Solutions to returntrue.win
1. !0
2. function(){return 'true';}
3. !0
4. 0
5. 𪒧
6. $GLOBALS[v] = create_function('', 'return $GLOBALS[v];')
7. (object)[!0]
8. new class extends Bar{}
9. N //or NaN (if you do not like errors)
10. function(&$x){$x=new Bar(1);}
@bordeux
bordeux / CloudWatchFormatter.php
Created January 4, 2018 17:51
CloudWatchFormatter for Monolog
<?php
namespace YourBundle\OwnNamespace\Monolog\Formatter;
use Monolog\Formatter\NormalizerFormatter;
/**
* Class CloudWatchFormatter
* @author Chris Bednarczyk <bordeux>
* @package YourBundle\OwnNamespace\Monolog\Formatter
@bordeux
bordeux / cronox.js
Last active September 6, 2017 19:05
Cronox killer
var hehe = function(){
function uniqueArray(minRange, maxRange, arrayLength) {
var arrayLength = (arrayLength) ? arrayLength : 10
var minRange = (minRange !== undefined) ? minRange : 1
var maxRange = (maxRange !== undefined) ? maxRange : 100
var numberOfItemsInArray = 0
var hash = {}
var array = []
var utils = {};
utils.getString = function (func) {
var result = func();
if (typeof result !== "undefined") {
return result;
}
var re = /<string[^>]*>([\s\S]*?)<\/string>/ig;
-- phpMyAdmin SQL Dump
-- version 4.1.6
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Jun 28, 2014 at 06:05 PM
-- Server version: 5.5.34-0ubuntu0.13.04.1
-- PHP Version: 5.5.13-2+deb.sury.org~precise+1
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";