Skip to content

Instantly share code, notes, and snippets.

View rjindael's full-sized avatar

rj rjindael

View GitHub Profile
@rjindael
rjindael / bitwise
Last active September 28, 2023 06:09
/*
* Check if a user can perform an action (with its value in "flag") of a specific roleset (named with "roleset".)
* Optionally, may check for if the user is a superadmin (with "shouldWeCareIfThisUserIsSuperadmin") as if the user
* is a superadmin, this function will return true no matter what since superadmins have every permission.
*/
bool may(string roleset, string flag, bool shouldWeCareIfThisUserIsSuperadmin) {
// (1). Because users that are superadmin has every permission regardless of their roleset permission, check for that.
if (!shouldWeCareIfThisUserIsSuperadmin && this.isSuperAdmin()) {
return true;
}
// null values can be anything
let envelope = {
"Mode": "GameServer",
"Settings": {
"PlaceId": placeId,
"PlaceFetchUrl": `http://${domain}/${null}/`,
"UniverseId": universeId,
"MatchmakingContextId": 1,
"CreatorId": userId,
"CreatorType": "User",
using System;
using System.Drawing;
class NameColors
{
private static Color[] BasePalette = {
Color.FromArgb(107, 50, 124),
Color.FromArgb(218, 133, 65),
Color.FromArgb(245, 205, 48),
Color.FromArgb(232, 186, 200),
var basePalette = [
{ "r": 107, "g": 50, "b": 124 },
{ "r": 218, "g": 133, "b": 65 },
{ "r": 245, "g": 205, "b": 48 },
{ "r": 232, "g": 186, "b": 200 },
{ "r": 215, "g": 197, "b": 154 }
]
var modernPalette = [
{ "r": 253, "g": 41, "b": 67 },
const rcctalk = require("rcctalk")
const path = require("path")
const uuid = require("uuid")
// If you omit the WSDL, then rcctalk will assume that the RCCService instance is a RCCService from 2018 or higher that does not use SOAP and instead uses the newer JSON format.
var client = rcctalk.connect({ ip: "127.0.0.1", port: 64989, wsdl: path.join(__dirname, "RCCServiceSoap.wsdl") })
/* HelloWorld */
if (await client.hello() != "Hello World") {
gfx.font_rendering.cleartype_params.enhanced_contrast = 0
gfx.font_rendering.cleartype_params.rendering_mode = 5
gfx.font_rendering.cleartype_params.force_gdi_classic_for_families = ""
@rjindael
rjindael / md5.php
Last active February 23, 2021 14:32
Example MD5 hash collision in PHP
<?php
// See: https://en.wikipedia.org/wiki/MD5#Collision_vulnerabilities
$x = "d131dd02c5e6eec4693d9a0698aff95c2fcab58712467eab4004583eb8fb7f8955ad340609f4b30283e488832571415a085125e8f7cdc99fd91dbdf280373c5bd8823e3156348f5bae6dacd436c919c6dd53e2b487da03fd02396306d248cda0e99f33420f577ee8ce54b67080a80d1ec69821bcb6a8839396f9652b6ff72a70";
$y = "d131dd02c5e6eec4693d9a0698aff95c2fcab50712467eab4004583eb8fb7f8955ad340609f4b30283e4888325f1415a085125e8f7cdc99fd91dbd7280373c5bd8823e3156348f5bae6dacd436c919c6dd53e23487da03fd02396306d248cda0e99f33420f577ee8ce54b67080280d1ec69821bcb6a8839396f965ab6ff72a70";
$x = hex2bin($x);
$y = hex2bin($y);
echo("MD5 Hash of X: " . md5($x) . "\n");
@rjindael
rjindael / app.js
Created January 19, 2021 23:46
Renames files in a given folder to a random string
const fs = require("fs")
const crypto = require("crypto")
const folder = "./Sort"
const files = fs.readdirSync(folder)
for (var i = 0; i < files.length; i++) {
let oldname = files[i]
let newname = ((crypto.randomBytes(16).toString("hex")) + "." + (oldname.substring(oldname.lastIndexOf(".") + 1)))
fs.rename(`${folder}/${oldname}`, `${folder}/${newname}`, (error) => {
@rjindael
rjindael / asset.php
Last active September 19, 2020 04:25
Get Roblox assets in PHP, can be used as passthrough function
<?php
function parse_response_headers($headers)
{
$head = [];
foreach ($headers as $key => $value)
{
$type = explode(":", $value, 2);
if (isset($type[1]))
{
<?php
function lua_mod($a, $b)
{
return ($a - floor($a / $b) * $b);
}
function compute_name_color($name, $modern_colors = true)
{
$base_palette = [
[ "R" => 107, "G" => 50, "B" => 124 ],