Skip to content

Instantly share code, notes, and snippets.

@justinbeaty
justinbeaty / Quote.php
Last active April 10, 2025 13:08
Magento 1.9 / OpenMage / Maho - Store sales rules on quote and order table
<?php
class My_Module_Model_Observer_Quote
{
public function salesruleProcess(Varien_Event_Observer $event)
{
$quote = $event->getQuote();
$item = $event->getItem();
$rule = $event->getRule();
@davidjenni
davidjenni / cidrToIpRange.ps1
Created January 7, 2020 18:08
CIDR to IP range conversion using PowerShell
# calculate IP address range from CIDR notation
# https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing
function cidrToIpRange {
param (
[string] $cidrNotation
)
$addr, $maskLength = $cidrNotation -split '/'
[int]$maskLen = 0
@spiette
spiette / .LESS_TERMCAP
Created July 5, 2012 04:14
less environment variables for colors in man pages
# to be sourced from .profile, .bash_profile or .bashrc
# http://unix.stackexchange.com/questions/119/colors-in-man-pages
export LESS_TERMCAP_mb=$(tput setaf 2) # green
export LESS_TERMCAP_md=$(tput bold; tput setaf 4) # blue
export LESS_TERMCAP_me=$(tput sgr0)
export LESS_TERMCAP_so=$(tput bold; tput setaf 7; tput setab 4) # white on blue
export LESS_TERMCAP_se=$(tput rmso; tput sgr0) # reset previous line
export LESS_TERMCAP_us=$(tput smul; tput bold;) # underlined and bold
export LESS_TERMCAP_ue=$(tput rmul; tput sgr0)
export LESS_TERMCAP_mr=$(tput rev)
@peppergrayxyz
peppergrayxyz / qemu-vulkan-virtio.md
Last active April 10, 2025 13:06
QEMU with VirtIO GPU Vulkan Support

QEMU with VirtIO GPU Vulkan Support

With its latest reales qemu added the Venus patches so that virtio-gpu now support venus encapsulation for vulkan. This is one more piece to the puzzle towards full Vulkan support.

An outdated blog post on clollabora described in 2021 how to enable 3D acceleration of Vulkan applications in QEMU through the Venus experimental Vulkan driver for VirtIO-GPU with a local development environment. Following up on the outdated write up, this is how its done today.

Definitions

Let's start with the brief description of the projects mentioned in the post & extend them:

Everything I do in this guide is mostly taken from the Arch Wiki, and is for Arch Linux, obviously this can probably be applied to other Linux distributions especially Arch based ones, this guide is for people who want a laptop with similar effciency they had on Windows or MacOS. I hate the excuse of having to compromise on Linux to have good battery or thermals on laptops.

Please think of this guide as more of a starting point, if you're serious about fully optimizing your laptop research your laptop and the hardware inside of it as that can get you even further down the rabbit hole.

This guide assumes you have a relatively modern laptop with at least an SSD from the factory, if you don't, don't worry you can still probably follow this guide perfectly, if you have 32-bit laptop I'm using 64-bit packages only, but there should be 32-bit packges in the Arch multilib repo, **just don't assume everything will work or not break your laptop, please read carefully, and don't copy and paste commands or edit co

@akash-gajjar
akash-gajjar / tldv.py
Last active April 10, 2025 13:03
Download videos from TLDV.io
from datetime import datetime
from os import system
import requests
import json
## Please install ffmpeg before running this script and make sure it's in your PATH
## brew install ffmpeg
## Please install requests before running this script
## pip3 install requests
@jeffjohnson9046
jeffjohnson9046 / git-ignore.sh
Created August 11, 2015 21:02
Remove unwanted files from a git repo AFTER adding a .gitignore. The files will remain on disk.
## I just ran into this after initializing a Visual Studio project _before_ adding a .gitignore file (like an idiot).
## I felt real dumb commiting a bunch of files I didn't need to, so the commands below should do the trick. The first two commands
## came from the second answer on this post: http://stackoverflow.com/questions/7527982/applying-gitignore-to-committed-files
# See the unwanted files:
git ls-files -ci --exclude-standard
# Remove the unwanted files:
git ls-files -ci --exclude-standard -z | xargs -0 git rm --cached
@sunmeat
sunmeat / index.html
Created April 10, 2025 13:00
пример на static поля и методы в javascript
<!DOCTYPE html>
<html lang="">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>static поля и методы</title>
</head>
<body>
<script>
class Logger {
@kochuraa
kochuraa / waf-smoke-test.sh
Last active April 10, 2025 12:59
Lightweight Bash script to test basic WAF (Web Application Firewall) protections against common SQL injection and XSS payloads. Use this to quickly assess your web application’s surface against low-hanging injection vulnerabilities.
#!/bin/bash
# 🚀 Discover More: Testing Your Firewall in 60 Seconds: A Lightweight WAF Testing Script That Anyone Can Use
# Learn how this script works and the best practices for WAF testing.
# Read the full article here:
# 👉 https://medium.com/@kochuraa/testing-your-firewall-in-60-seconds-a-lightweight-waf-testing-script-that-anyone-can-use-a7a725fefcb7
# Safe WAF Tester Script
# Usage: ./waf-smoke-test.sh <URL> [-o output.md] [-H "Header: Value"]
# Examples:
@francis2110
francis2110 / LG infrared codes
Created January 22, 2015 10:01
Lg infrared codes for making your own remote
on-off->20DF10EF
energy->20DFA956
av. mode->20DF0CF3
input->20DFD02F
tv/rad->20DF0FF0
1->20DF8877
2->20DF48B7
3->20DFC837
4->20DF28D7
5->20DFA857