Skip to content

Instantly share code, notes, and snippets.

Matthew McConnell maca134

Block or report user

Report or block maca134

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@maca134
maca134 / bigint.ts
Last active Nov 30, 2019
BigInt to Buffer and Buffer to BigInt Nodejs
View bigint.ts
function bigIntToBuffer(num: bigint, endian: 'be' | 'le') {
const bytes: number[] = [];
while (num > 0) {
bytes.push(Number(num & 0xffn));
num = num >> 8n;
}
return Buffer.from(endian === 'be' ? bytes.reverse() : bytes);
}
function bufferToBigInt(bytes: Buffer, endian: 'be' | 'le') {
@maca134
maca134 / Group.cs
Created Aug 29, 2018
SQLite table sql from POCO
View Group.cs
namespace SQLiteTableBuilder
{
[Table]
public class Group
{
[Column(PrimaryKey = true, AutoIncrement = true)]
public int Id { get; set; }
[Column(Unique = true)]
public string Name { get; set; }
View m3e_exportselected.sqf
private _traders = [];
{
_traders pushBack [
typeOf _x,
(_x get3DENAttribute 'face') select 0,
["HubStanding_idle1"],
getPosATL _x,
getDir _x
];
} forEach ((get3DENSelected "group") apply {units _x select 0});
View copyconfig.sqf
MMC_fnc_getConfig = {
params [
['_base', configfile, [configfile]]
];
private _inherts = inheritsFrom _base;
private _output = [
if (configName _inherts != '') then {
format ['class %1 : %2 {', configName _base, configName _inherts]
} else {
format ['class %1 {', configName _base]
View gist:747090b3ad52d8d75b73
var async = require('async');
findMatches.prototype.find = function(checkhash, complete) {
var self = this;
var matches = [];
async.eachLimit(hashes, 5, function (hash, next) {
if (hamming(checkhash, hash.hash) < 10) {
console.log('emiiting match');
self.emit('found-match', hash);
matches.push(hash);
}
@maca134
maca134 / gist:94b78268f6727f5967f8
Created May 29, 2015
Parse ARMA String Array in C#
View gist:94b78268f6727f5967f8
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace mgroups.Core
{
public class ArmaArray : List<object>
{
public static ArmaArray Unserialize(string strarray)
View gist:a6b9c51925e97e544adb
/*
23:29:53 "EPOCH_clientInit: Hash: s3cave12i.008da5b19 | Verify Result: true"
23:29:53 "EPOCH_onEachFrame: Hash: urw32vfzt.b500bd86c | Verify Result: true"
23:29:55 "EPOCH_masterLoop: Hash: q3rowbiqo.34f6d340e | Verify Result: true"
23:29:55 "EPOCH_client_rejectPlayer: Hash: qzt12tqbm.83339f58d | Verify Result: true"
23:29:55 "EPOCH_clientRespawn: Hash: 3rndiefvx.78c7a9ffe | Verify Result: true"
23:29:56 "EPOCH_KeyDown: Hash: rhmlztikm.8cac0bfc5 | Verify Result: true"
*/
MMC_fnc_hashString = {
private ['_str', '_seed', '_dic', '_strArr', '_seedArr', '_seedLength', '_dicLength', '_hash'];
View gist:d98aa47d978f0242f5c1
// ARMA Hashing
MMC_fnc_hashString = {
private ['_str', '_seed', '_dic', '_seedLength', '_dicLength', '_hash'];
_str = toArray ([_this, 0, '', ['']] call BIS_fnc_param);
_seed = toArray ([_this, 1, 'seed', ['']] call BIS_fnc_param);
_dic = '0123456789abcdef';
_seedLength = count _seed;
_dicLength = count _dic;
for "_i" from 0 to (count _str) -1 do {
View gist:8c7b389fe54ba5fc5dfa
import socket #for sockets
import sys #for exit
import binascii
import time
import threading
def rcon_hash(msg):
hashdec = (binascii.crc32(msg) & 0xFFFFFFFF)
hashdec = "%08X" % hashdec
hx = '0x';
View gist:5648516
if(!_done) exitWith { diag_log("CUSTOM: failed to get id for : " + str(_uid)); };
//_object_para = "ParachuteMediumWest" createVehicle [0,0,0];
//_object_para setpos [_location select 0, _location select 1,(_location select 2) + 65];
_object = createVehicle [_class, [_location select 0, _location select 1, _location select 2], [], 0, "CAN_COLLIDE"];
_object setVariable ["ObjectID", _oid, true];
You can’t perform that action at this time.