Skip to content

Instantly share code, notes, and snippets.

global class CalculateBusinessHoursDiff {
global class request
{
@InvocableVariable(label='Business Hours Id' required = true)
global String businessHoursId;
@InvocableVariable(label='Start Date' required = true)
global DateTime startDate;
@InvocableVariable(label='End Date' required = true)
global DateTime endDate;
}
@thesamesam
thesamesam / xz-backdoor.md
Last active April 24, 2024 14:07
xz-utils backdoor situation (CVE-2024-3094)

FAQ on the xz-utils backdoor (CVE-2024-3094)

This is a living document. Everything in this document is made in good faith of being accurate, but like I just said; we don't yet know everything about what's going on.

Background

On March 29th, 2024, a backdoor was discovered in xz-utils, a suite of software that

@IonBazan
IonBazan / flag.php
Created October 22, 2021 09:27
Country code to country flag Emoji (PL -> 🇵🇱)
<?php
/**
* Converts country code (ISO 3166-1) to its emoji flag representation (PL -> 🇵🇱).
*
* This solution supports both lowercase and uppercase codes using modulo 32 .
* Since it doesn't perform any validation, you should make sure the code is a valid country code first.
*
* 0x1F1E5 is a code of character right before "REGIONAL INDICATOR SYMBOL LETTER A" (🇦).
*
@lordsarcastic
lordsarcastic / Implement OTP for Django application for multiple uses
Last active April 24, 2024 14:06
This is a generic implementation of OTP for Django applications. It can be extended to any framework or platform that uses OTP.
This is a robust implementation that is extensible for anything that requires the use of OTP. Want to use OTP to verify
a user? Check! Want to use OTP to validate an order? CHeck! Want to use OTP to reset a password? CHEck! Want to use
OTP to verify a device? CHECk! Want to use OTP to fight people? CHECK!
I used: Django (framework), Django Rest Framework (a plugin for REST API), PostgreSQL (database)
and email (for sending the otp). You can substitute any of these for whatever you want, like using Redis instead of Postgres.
While this solution is built to be used for Django, I have added comments to explain the process for developers using
other frameworks.
Legend:
#!/bin/bash
##
## Session globals
##
# unset DISPLAY
export XDG_CURRENT_DESKTOP=gamescope # necessary for ryujinx to render properly
export SDL_VIDEO_MINIMIZE_ON_FOCUS_LOSS=0
@pantasio
pantasio / 69-libmtp.rules
Created March 30, 2018 10:43
/lib/udev/rules.d/69-libmtp.rules
#https://forum.xda-developers.com/oneplus-3/how-to/guide-connect-op3-mtp-linux-ubuntu-t3402472
Unable to open ~/.mtpz-data for reading, MTPZ disabled.# UDEV-style hotplug map for libmtp
# Put this file in /etc/udev/rules.d
ACTION!="add", GOTO="libmtp_rules_end"
ENV{MAJOR}!="?*", GOTO="libmtp_rules_end"
SUBSYSTEM=="usb", GOTO="libmtp_usb_rules"
GOTO="libmtp_rules_end"
LABEL="libmtp_usb_rules"
@smores56
smores56 / weaver-talk.md
Last active April 24, 2024 14:05
Presentation slides for my talk about github.com/smores56/weaver

Weaver

An ergonomic arg parsing library for the Roc programming language.


Table of Contents

  • Introductions
  • Why did I want to make this library?
@lucasmezencio
lucasmezencio / SLUG.md
Last active April 24, 2024 14:01
Creating URL slugs properly in PHP (including transliteration for UTF-8)

Creating URL slugs properly in PHP (including transliteration for UTF-8)

The point to use a slug (semantic URL) besides of improve the SEO of your articles is to prevent that the user, at the creation of for example an article, it uses special characters that aren't allowed in a URL, appropiate the usage etc. What target usage means, is context dependent.

In this article, you'll learn how to slugify a string in PHP properly, including (or not) support (conversion) for cyrilic and special latin characters.

Slugify in PHP

The following function exposes a simple way to convert text into a valid slug:

@clarkli86
clarkli86 / ldd_awk.sh
Created March 16, 2016 02:10
Copy all shared libraries for a binary to directory
ldd file | grep "=> /" | awk '{print $3}' | xargs -I '{}' cp -v '{}' /destination
@pvanderwoude
pvanderwoude / Remediate-LocalAdministrators.ps1
Created September 28, 2020 14:02
Remediate-LocalAdministrators
#Define variables
$currentUser = (Get-CimInstance Win32_ComputerSystem).Username -replace '.*\\'
$localAdministrators = @("[YourGlobalAdminRoleSid]","[YourDeviceAdminRoleSid]") #Adjust to your local administrators
try {
$administratorsGroup = ([ADSI]"WinNT://$env:COMPUTERNAME").psbase.children.find("Administrators")
$administratorsGroupMembers = $administratorsGroup.psbase.invoke("Members")
foreach ($administratorsGroupMember in $administratorsGroupMembers) {
$administrator = $administratorsGroupMember.GetType().InvokeMember('Name','GetProperty',$null,$administratorsGroupMember,$null)
if (($administrator -ne "Administrator") -and ($administrator -ne $currentUser)) {