Skip to content

Instantly share code, notes, and snippets.

@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)) {
@pvanderwoude
pvanderwoude / Detect-LocalAdministrators.ps1
Last active April 24, 2024 13:57
Detect-LocalAdministrators
#Define variables
$localAdministrators = @()
$memberCount = 0
$numberLocalAdministrators = 4 #Adjust to your number of administrators
try {
$currentUser = (Get-CimInstance Win32_ComputerSystem).Username -replace '.*\\'
$administratorsGroup = ([ADSI]"WinNT://$env:COMPUTERNAME").psbase.children.find("Administrators")
$administratorsGroupMembers= $administratorsGroup.psbase.invoke("Members")
foreach ($administrator in $administratorsGroupMembers) {
{"contents":{"python":{"pythonPath":"C:\\Program Files (x86)\\Microsoft Visual Studio\\Shared\\Python36_64\\python.exe"},"eslint":{"enable":true},"launch":{"version":"0.2.0","configurations":[{"type":"node","request":"launch","name":"Launch Program","program":"${workspaceFolder}\\server.js"}]}},"overrides":[],"keys":["python.pythonPath","eslint.enable","launch.version","launch.configurations"]}
@metalinspired
metalinspired / main.cpp
Last active April 24, 2024 13:55
TMC2209 UART
/**
* Author Milan Divkovic
*
* You can control the motor with following commands:
* 0: Disables the motor
* 1: Enables the motor
* + or -: Increase or decrease speed in respect to rotation direction
*/
#include <Arduino.h>
@sdlee3
sdlee3 / UIDevice_Jaibroken.swift
Last active April 24, 2024 13:56
Jailbroken and Simulator detection
import Foundation
import UIKit
import MachO
extension UIDevice {
var isSimulator: Bool {
return TARGET_OS_SIMULATOR != 0
}
@biochem-fan
biochem-fan / NOTES.md
Last active April 24, 2024 13:54
Warp-RELION4-M Protocol
@jboner
jboner / latency.txt
Last active April 24, 2024 13:53
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@esgomezm
esgomezm / dl4miceverywhere-practical-EBI-EMBL.md
Last active April 24, 2024 13:52
EBI-EMBL Microscopy data analysis course - DL4MicEverywhere practical session