Skip to content

Instantly share code, notes, and snippets.

<?php
require __dir__.'/../vendor/autoload.php';
function uuid() {
$raw = openssl_random_pseudo_bytes(16);
$raw[6] = chr(ord($raw[6]) & 0x0f | 0x40);
$raw[8] = chr(ord($raw[8]) & 0x3f | 0x80);
return vsprintf('%s%s-%s-%s-%s-%s%s%s', str_split(bin2hex($raw), 4));
}
Start
= KeyValue*
KeyValue
= __ key:Key __ value:(Value / Section) __ {
return {key: key, value: value};
}
Key "key"
= QuotedString
#include <sourcemod>
#pragma semicolon 1
#pragma newdecls required
public Plugin myinfo = {
name = "",
author = "",
description = "",
version = "0.0.0",
@asherkin
asherkin / gist:8cacbb8c99a5aae41a8b549acf976cb3
Created December 16, 2017 12:26
OnClientPostAdminCheckAndCookiesCached
bool g_bIsPostAdminCheck[MAXPLAYERS + 1];
void OnClientPostAdminCheckAndCookiesCached(int client)
{
// Do thing.
}
void OnClientConnected(int client)
{
g_bIsPostAdminCheck[client] = false;
'use strict';
process.env.TZ = 'America/New_York';
const https = require('https');
const xml2js = require('xml2js');
const sourceUrl = 'https://forums.alliedmods.net/external.php?type=xml&forumids=108&count=5';
function formatTimestamp(date, time) {
'use strict';
const redis = require('redis').createClient();
const Firebase = require('firebase');
const nest = new Firebase('wss://developer-api.nest.com');
nest.auth('REDACTED');
const HueApi = require("node-hue-api").HueApi;
const hue = new HueApi('REDACTED', 'REDACTED');
diff --git a/vm/scripted-invoker.cpp b/vm/scripted-invoker.cpp
index 7ecd2bc..a7ef128 100644
--- a/vm/scripted-invoker.cpp
+++ b/vm/scripted-invoker.cpp
@@ -292,8 +292,14 @@ ScriptedInvoker::Invoke(cell_t *result)
}
/* Make the call if we can */
- if (ok)
+ if (ok) {
@asherkin
asherkin / index.php
Last active October 19, 2016 15:32
C.H.I.P. Battery Page
<?php
class Register {
// Single-register bitflags
const POWER_INPUT_STATUS = 0x00;
const POWER_OPERATING_MODE_AND_CHARGE_STATUS = 0x01;
const ADC_ENABLE_ONE = 0x82;
const ADC_ENABLE_TWO = 0x83;
// Double-register values
// Usage:
//
// HalifaxAPI.getTransactionHistoryQIF(300).then((qif) => console.log(qif));
//
(function() {
'use strict';
const StatementBaseUrl = 'https://secure.halifax-online.co.uk/personal/link/lp_statement_ajax';
const StatementType = Object.freeze({
var SteamCommunity = require('steamcommunity');
var http = require('http');
var steam = new SteamCommunity();
steam.login({
accountName: '[redacted]',
password: '[redacted]',
steamguard: '[redacted]',
}, function(err) {