Skip to content

Instantly share code, notes, and snippets.

View cyanide-burnout's full-sized avatar

Artem Prilutskiy cyanide-burnout

View GitHub Profile
@cyanide-burnout
cyanide-burnout / taco-toolkit.dockerfile
Last active October 1, 2023 07:42
Tableau WDC 3.0 taco-toolkit in Docker
FROM debian:bullseye-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update
RUN apt-get install -y ca-certificates curl gnupg python3 build-essential
RUN mkdir -p /etc/apt/keyrings
RUN curl -fsSL https://deb.nodesource.com/gpgkey/nodesource-repo.gpg.key | gpg --dearmor -o /etc/apt/keyrings/nodesource.gpg
RUN echo "deb [signed-by=/etc/apt/keyrings/nodesource.gpg] https://deb.nodesource.com/node_18.x nodistro main" | tee /etc/apt/sources.list.d/nodesource.list
RUN apt-get update
@cyanide-burnout
cyanide-burnout / helper-spirv.dockerfile
Last active November 14, 2022 15:53
SPIR-V in Docker (clang 15 + libclcxx / clang 14)
FROM debian:bullseye-slim
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get upgrade -y
RUN apt-get install -y \
build-essential apt-utils python3 git curl \
libxml2-dev zlib1g-dev libedit-dev
RUN git config --global user.email "you@example.com" && git config --global user.name "Your Name"
@cyanide-burnout
cyanide-burnout / snapshot.ps1
Last active September 24, 2022 07:21
Create a shadow copy of disk
$drive = "F:"
# Create and mount shadow copy
$snapshot = (Get-WmiObject -List Win32_ShadowCopy).Create("$drive\\", "ClientAccessible")
$copy = Get-WmiObject Win32_ShadowCopy | Where-Object { $_.ID -eq $snapshot.ShadowID }
cmd /C mklink /d $drive\ShadowCopy "$($copy.DeviceObject)\\"
@cyanide-burnout
cyanide-burnout / graph-group.php
Last active September 21, 2022 09:09
Check user group membership in Azure AD (including inheritance)
<?php
if (array_key_exists("access_token", $_SESSION))
{
$handle = curl_init();
curl_setopt($handle, CURLOPT_POST, true);
curl_setopt($handle, CURLOPT_URL, "https://graph.microsoft.com/v1.0/me/checkMemberGroups");
curl_setopt($handle, CURLOPT_HTTPHEADER, array("Authorization: Bearer " . $_SESSION["access_token"], "Content-Type: application/json"));
curl_setopt($handle, CURLOPT_POSTFIELDS, "{\"groupIds\":[" . GRAPH_GROUP_LIST . "]}");
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
@cyanide-burnout
cyanide-burnout / graph-membership.php
Last active September 21, 2022 09:10
Check user membership in Azure AD (direct membership)
<?php
// https://learn.microsoft.com/en-us/graph/api/user-list-memberof?view=graph-rest-1.0&tabs=http
if (array_key_exists("access_token", $_SESSION))
{
$handle = curl_init();
curl_setopt($handle, CURLOPT_HTTPHEADER, array("Authorization: Bearer " . $_SESSION["access_token"]));
curl_setopt($handle, CURLOPT_URL, "https://graph.microsoft.com/v1.0/me/memberOf");
curl_setopt($handle, CURLOPT_RETURNTRANSFER, true);
@cyanide-burnout
cyanide-burnout / auth.php
Last active November 24, 2023 14:58
Authentication in Azure AD
<?php
// https://katystech.blog/projects/php-azuread-oauth-login
// https://docs.microsoft.com/en-us/azure/active-directory/develop/v2-oauth2-auth-code-flow
// Configuration settings: OAUTH_TENANT_ID, OAUTH_CLIENT_ID, OAUTH_CLIENT_SECRET
require_once("config.php");
session_start();
@cyanide-burnout
cyanide-burnout / guard.lua
Last active November 12, 2023 00:53
IP- and cookie-based authorization guard for haproxy
--[[
IP- and cookie-based authorization guard for haproxy
https://www.haproxy.com/blog/5-ways-to-extend-haproxy-with-lua/
Guard checks permit in memcached, any value of key 'Allow-Address-<Address>' or 'Allow-Session-<Session>' will be accepted
Where:
<Address> is client's IP-address
<Session> is value of cookie 'XGuardKey'
Parameter 'action' can be:
@cyanide-burnout
cyanide-burnout / Rewind.h
Created June 6, 2018 15:23
Suggestion for Simple Terminal Client protocol
#ifndef REWIND_H
#define REWIND_H
#include <stdint.h>
#include <netinet/in.h>
#ifdef __cplusplus
extern "C"
{
#endif