View addParityBits.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @param string $key - Input 7 byte DES key, without parity bits, in hex format | |
* @return string - Output 8 byte DES key, with parity bits, in hex format | |
*/ | |
function addParityBitsToDESKey($key) { | |
$binary = base_convert($key, 16, 2); | |
$bytes = str_split($binary, 7); |
View .js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const fetch = require("node-fetch") | |
const fs = require("fs") | |
const PINGDOM_API_KEY = process.env.PINGDOM_API_KEY | |
const AWS = require('aws-sdk') | |
const s3 = new AWS.S3({signatureVersion: 'v4'}) | |
const checksConfig = [ | |
{ | |
id: 123, | |
title: 'event' |
View .js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
addEventListener('fetch', event => { | |
event.respondWith(handleRequest(event.request)) | |
}) | |
const string2buffer = string => { | |
let tempArray = new Uint8Array(string.length) | |
for(let i = string.length; i--) tempArray[i] = string.charCodeAt(i) | |
return tempArray.buffer | |
} |
View Rails structure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
./app/assets | |
./app/assets/config | |
./app/assets/images | |
./app/assets/javascripts | |
./app/assets/javascripts/channels | |
./app/assets/stylesheets | |
./app/channels/application_cable | |
./app/controllers | |
./app/controllers/concerns | |
./app/helpers |
View config.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
return (static function() { | |
$configTemplate = [ | |
'routes' => [ | |
[ | |
'aggregate' => true, | |
'method' => 'GET', | |
'path' => '/v1/devices/{mac}/details', | |
'actions' => [ | |
'device' => [ |
View AppServiceProvider.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class AppServiceProvider extends ServiceProvider | |
{ | |
/** | |
* @return void | |
*/ | |
protected function registerRoutes() | |
{ | |
$registry = $this->app->make(RouteRegistry::class); |
View RouteRegistry.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class RouteRegistry | |
{ | |
/** | |
* @param Application $app | |
*/ | |
public function bind(Application $app) | |
{ | |
$this->getRoutes()->each(function ($route) use ($app) { |
View GatewayController.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class GatewayController extends Controller | |
{ | |
/** | |
* @param Request $request | |
* @param RestClient $client | |
* @return Response | |
*/ | |
public function get(Request $request, RestClient $client) |