Skip to content

Instantly share code, notes, and snippets.

'''
https://arxiv.org/abs/2312.00858
1. put this file in ComfyUI/custom_nodes
2. load node from <loaders>
start_step, end_step: apply this method when the timestep is between start_step and end_step
cache_interval: interval of caching (1 means no caching)
cache_depth: depth of caching
'''
@martjanz
martjanz / create_table.sql
Created May 22, 2020 20:02
Text field spell checker (PostgreSQL)
CREATE TABLE dict_english (
word varchar NOT NULL
);
CREATE UNIQUE INDEX dict_english_word_idx ON dict_english (word);
@pramsey
pramsey / 0-spatial-sql-postgis.md
Last active November 13, 2023 18:33
Spatial SQL and PostGIS
@Neo23x0
Neo23x0 / audit.rules
Last active September 16, 2024 14:59
Linux Auditd Best Practice Configuration
# IMPORTANT!
# This gist has been transformed into a github repo
# You can find the most recent version there:
# https://github.com/Neo23x0/auditd
# ___ ___ __ __
# / | __ ______/ (_) /_____/ /
# / /| |/ / / / __ / / __/ __ /
# / ___ / /_/ / /_/ / / /_/ /_/ /
# /_/ |_\__,_/\__,_/_/\__/\__,_/
@procrastinatio
procrastinatio / haproxy_rate_limiting.md
Created October 25, 2017 06:04
Rate limiting with HAproxy

Introduction

So HAProxy is primalery a load balancer an proxy for TCP and HTTP. But it may act as a traffic regulator. It may also be used as a protection against DDoS and service abuse, by maintening a wide variety of statistics (IP, URL, cookie) and when abuse is happening, action as denying, redirecting to other backend may undertaken ([haproxy ddos config], [haproxy ddos])

@stuartduff
stuartduff / wc-exclude-product-category-from-shop-page.php
Last active May 6, 2022 00:20
This snippet will exclude all products from any categories which you choose from displaying on the WooCommerce Shop page.
function custom_pre_get_posts_query( $q ) {
$tax_query = (array) $q->get( 'tax_query' );
$tax_query[] = array(
'taxonomy' => 'product_cat',
'field' => 'slug',
'terms' => array( 'clothing' ), // Don't display products in the clothing category on the shop page.
'operator' => 'NOT IN'
);
@Brainiarc7
Brainiarc7 / badips.sh
Created December 26, 2016 23:29
Script to add IPs from https://www.badips.com/ to iptables. It has an associated spinner function for user feedback. Be sure to mind / update your Paths as necessary.
#!/opt/bin/bash
# Script for blocking IPs which have been reported to www.badips.com
# Usage: Just execute by e.g. cron every day
# ---------------------------
_ipt=/sbin/iptables # Location of iptables (might be correct)
_input=badips.db # Name of database (will be downloaded with this name)
_pub_if=eth0 # Device which is connected to the internet (ex. $ifconfig for that)
_droplist=badip-droplist # Name of chain in iptables (Only change this if you have already a chain with this name)
_level=4 # Blog level: not so bad/false report (0) over confirmed bad (3) to quite aggressive (5) (see www.badips.com for that)
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Written as part of https://www.scrapehero.com/how-to-scrape-amazon-product-reviews-using-python/
from lxml import html
import json
import requests
import json,re
from dateutil import parser as dateparser
from time import sleep
@dtbaker
dtbaker / create-quote.php
Last active June 2, 2018 20:23
Create a quote in UCM from a remote url
<?php
chdir('/path/to/ucm/folder/on/webhost/');
include('init.php'); // the UCM init code.
// login as admin
module_security::user_id_temp_set(1);
$customer_data = array(
'customer_name' => 'Name Here',
@dtbaker
dtbaker / run_bot.php
Created May 28, 2016 12:29
Run this PHP script and it will start a "bot" user on Slack that does Google Searches for you
<?php
require 'vendor/autoload.php';
use PhpSlackBot\Bot;
// Custom command
class MyCommand extends \PhpSlackBot\Command\BaseCommand {
protected function configure() {
$this->setName('bot');