Skip to content

Instantly share code, notes, and snippets.

View Efreak's full-sized avatar
😴
😪😴🥱😌💤

Efreak Efreak

😴
😪😴🥱😌💤
View GitHub Profile
@daveschumaker
daveschumaker / prompt_expansion.js
Created January 12, 2024 06:09
Poor Man's Prompt Expansion for Stable Diffusion
/**
* Various Stable Diffusion models massively benefit from prompt descriptions that contain
* additional descriptors. Much recent research has gone into training text generation models for
* expanding existing Stable Diffusion prompts with relevant and context appropriate descriptors.
*
* Since it isn't feasible to run LLMs and text generation models inside most users' web browsers
* at this time, I present my "Poor Man's Prompt Expansion Model". It uses a number of examples
* I've acquired from Fooocus and Hugging Face to generate completely random
* (though not context appropriate) prompt expansions.
*/
@Dan-Q
Dan-Q / _no_code_page_.php
Last active December 28, 2023 18:01
Hacky PHP to produce a "blank" web page which somehow has content when viewed in Firefox. Sample page at https://danq.me/wp-content/no-code-webpage/, explanation at https://danq.me/nocode
<?php
// half-hearted CSS minification
$css = preg_replace(
array('/\s*(\w)\s*{\s*/','/\s*(\S*:)(\s*)([^;]*)(\s|\n)*;(\n|\s)*/','/\n/','/\s*}\s*/'),
array('$1{ ','$1$3;',"",'} '),
file_get_contents('linked.css')
);
// embed as a data: uri
$base64css = rtrim(strtr(base64_encode($css), '+/', '-_'), '=');
@Efreak
Efreak / cargo-csearch.bsh
Last active January 9, 2022 18:25
list packages installed via cargo with colored columns for package name, version, and installed binaries
#!/usr/bin/env bash
if [ "$1" = "csearch" ]; then shift; fi #remove subcommand if called via `cargo csearch`
c33=$'\033[33m'
c34=$'\033[34m'
c35=$'\033[35m'
c0=$'\033[0m'
list="$(cargo search $@)"
@garbled1
garbled1 / build_cbz.sh
Created October 28, 2020 15:17
Download webcomics with dosage into CBZ files nightly. Uses to_cbz and dosage
#!/bin/bash
source ~/venv/bin/activate
rm /comics/download/WebToons/*/complete.txt
dosage -b /comics/download -c @
COMIC_DL=/comics/download
COMIC_CBZ=/comics/cbz
COMIC_TMP=/comics/tmp
@heyarne
heyarne / airsonic.fish
Last active October 22, 2020 23:36
A simple command-line wrapper for interacting with the airsonic api. 🎧 Needs https://fishshell.com/ and https://httpie.org/.
#!/usr/bin/env fish
# Put this in your .config/fish/functions folder and you'll get an `airsonic`
# command that you can use to interact with the rest api. If you just want to
# play around with it, you can execute it directly.
function _airsonic_usage
echo 'Usage: airsonic [-h|--help] -u $user -p $pass [$url] $endpoint [...$params]'
echo
echo 'Interact with an airsonic server via REST. See http://www.subsonic.org/pages/api.jsp for additional documentation.'
@rektdeckard
rektdeckard / drawable-tool.sh
Last active May 17, 2022 02:59
A suite of bash scripts for Android icon pack creators. Generate drawable.xml and icon-pack.xml from directory of icons, and map appfilter.xml to the other filter file formats.
#!/bin/bash
## Drawable Tool
## created 2019.6.15
## updated 2019.7.20
## author Tobias Fried <friedtm@gmail.com>
## A bash script for Android Icon Pack creators
## Create a list of drawable resources (PNGs) in the specified directory, in the format required for your drawable.xml
DRAWABLE="drawable.xml"
@cerebrate
cerebrate / README.md
Last active December 2, 2023 08:17
Recompile your WSL2 kernel - support for snaps, apparmor, lxc, etc.

WARNING

THIS GIST IS EXTREMELY OBSOLETE. DO NOT FOLLOW THESE INSTRUCTIONS. SERIOUSLY.

IF YOU IGNORE THE ABOVE WARNING, YOU AGREE IN ADVANCE THAT YOU DIDN'T GET THESE INSTRUCTIONS FROM ME, THAT I WARNED YOU, AND THAT I RESERVE THE RIGHT TO POINT AND LAUGH MOCKINGLY IF AND WHEN SOMETHING BREAKS HORRIBLY.

I'll do a write-up of current custom-kernel procedures over on Random Bytes ( https://randombytes.substack.com/ ) one day soon.

NOTE

@timvisee
timvisee / falsehoods-programming-time-list.md
Last active April 22, 2024 16:30
Falsehoods programmers believe about time, in a single list

Falsehoods programmers believe about time

This is a compiled list of falsehoods programmers tend to believe about working with time.

Don't re-invent a date time library yourself. If you think you understand everything about time, you're probably doing it wrong.

Falsehoods

  • There are always 24 hours in a day.
  • February is always 28 days long.
  • Any 24-hour period will always begin and end in the same day (or week, or month).
@whid-injector
whid-injector / HuddledTricks.psm1
Created November 21, 2017 10:48 — forked from Jaykul/HuddledTricks.psm1
Stupid PowerShell Tricks
#Requires -version 2.0
## Stupid PowerShell Tricks
###################################################################################################
add-type @"
using System;
using System.Runtime.InteropServices;
public class Tricks {
[DllImport("user32.dll")]
private static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
@nikonthethird
nikonthethird / Snake.ps1
Last active April 18, 2024 00:19
PowerShell script for playing Snake.
#Requires -Version 5.1
Using Assembly PresentationCore
Using Assembly PresentationFramework
Using Namespace System.Collections.Generic
Using Namespace System.ComponentModel
Using Namespace System.Linq
Using Namespace System.Reflection
Using Namespace System.Text
Using Namespace System.Windows
Using Namespace System.Windows.Input