Skip to content

Instantly share code, notes, and snippets.

@MikeNGarrett
MikeNGarrett / wp-config.php
Last active April 25, 2024 09:44
All those damned wp-config constants you can never remember.
<?php
// PHP memory limit for this site
define( 'WP_MEMORY_LIMIT', '128M' );
define( 'WP_MAX_MEMORY_LIMIT', '256M' ); // Increase admin-side memory limit.
// Database
define( 'WP_ALLOW_REPAIR', true ); // Allow WordPress to automatically repair your database.
define( 'DO_NOT_UPGRADE_GLOBAL_TABLES', true ); // Don't make database upgrades on global tables (like users)
// Explicitely setting url
@savegame
savegame / pulse_sreaming.md
Last active April 25, 2024 09:44
PulseAudio / PipeWire streaming audio from Client to remote PulseAudio / PipeWire Server

We have Server machine, this computer with Headphones, and we have Client computer, this is remote PC with music =) On Server we should first open port for listening connections from Client :

# on ubuntu 
sudo ufw allow from <Client_IP> to any port 4656 proto tcp
# on fedora ( with firewalld ) 
sudo firewall-ctl --add-port 4656/tcp

note: port 4656 just for sample. you can use any port you want
than on Server, from current user add listening for connections

@Kr1lle
Kr1lle / FloatingItem.java
Last active April 25, 2024 09:43
Recreation of the Emerald and Diamond generators from Hypixel BedWars
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Location;
import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.EntityType;
import org.bukkit.inventory.ItemStack;
import org.bukkit.plugin.java.JavaPlugin;
import org.bukkit.scheduler.BukkitRunnable;
@alvarobartt
alvarobartt / dpo-qlora-4bit.py
Last active April 25, 2024 09:42
DPO fine-tuning using `trl.DPOTrainer` and Q-LoRA (4-bit)
import torch
from datasets import load_dataset
from peft import LoraConfig, get_peft_model
from transformers import AutoTokenizer, AutoModelForCausalLM
from trl import DPOTrainer
if __name__ == "__main__":
model_name = "..."
dataset = load_dataset(...)
@schacon
schacon / better-git-branch.sh
Created January 13, 2024 18:41
Better Git Branch output
#!/bin/bash
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
BLUE='\033[0;34m'
YELLOW='\033[0;33m'
NO_COLOR='\033[0m'
@Hertzole
Hertzole / SceneObject.cs
Last active April 25, 2024 09:39
Unity scene object to easily assign scenes in the inspector.
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;
#endif
[System.Serializable]
public class SceneObject
{
[SerializeField]
private string m_SceneName;
@Farrukhw
Farrukhw / ChocoletyInstall.ps1
Last active April 25, 2024 09:38
Powershell scripts
# The array, holding the names of the Chocolatey Packages from https://community.chocolatey.org/packages.
# 'nginx', 'openjdk','microsoft-edge'
$Packages = 'nodejs','openjdk11','python','postgresql','openssh','openssl','git','tortoisegit','freecommander-xe.install','vscode','notepadplusplus','Everything','7zip', 'grepwin','winmerge','conemu',
#check if Chocolatey is installed or not
$ChocoVersion=Invoke-Expression 'choco -v'
@Vrekrer
Vrekrer / QThreadDecorators.py
Last active April 25, 2024 09:39
Easy QT threading using python decorators.
# -*- coding: utf-8 -*-
from PyQt4 import QtCore
from functools import wraps
class Exception_StopQThread(Exception):
pass
class Runnable(QtCore.QRunnable):
def __init__(self, func, args, kwargs):
@ArvidSilverlock
ArvidSilverlock / extendedbuffer.lua
Last active April 25, 2024 09:38
Possibly useful `read` and `write` functions for `buffer`s that aren't inluded in the normal API
--[[
Copyright 2024 Arvid
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (theSoftware”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDEDAS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR T