Skip to content

Instantly share code, notes, and snippets.

View bfu4's full-sized avatar
🌸

bfu4 bfu4

🌸
View GitHub Profile
@bfu4
bfu4 / main.cf
Created February 9, 2023 15:48
postfix config
# ------------------------------------------------------------------ #
# POSTFIX CONFIGURATION #
# ------------------------------------------------------------------ #
# ------------------------------------------------------------------ #
# 1. WHO IS THIS MAIL SERVER? #
# ------------------------------------------------------------------ #
myorigin = /etc/mailname
172.104.159.48
141.98.10.0/24
@bfu4
bfu4 / iuadd
Last active March 29, 2022 14:08
#!/bin/bash
useradd -s /bin/bash -d /lab $1
printf "$2\n$2\n" | passwd $1
usermod -aG sudo $1
@bfu4
bfu4 / color.go
Created August 20, 2021 05:43
colors again
package colors
import "strconv"
type Color int
const (
Black Color = iota
Red
Green
@bfu4
bfu4 / Entry.java
Created July 17, 2021 02:23
instance building utilizing generics (and bloat) to try to make any instance of a class as possible
/**
* Base abstraction of a pair.
*
* @param <K> key
* @param <V> value
*/
public interface Entry<K, V> {
/**
* Get key.
@bfu4
bfu4 / ObtuseReflection.java
Last active October 10, 2021 21:47
aids way to construct an object from a class and argument type fuck box types fr
public <T> T makeObject(Class<T> clazz, Object... args) throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException {
Class<?>[] types = Arrays.stream(args).map(cls -> getPrimitiveType(cls.getClass())).toArray(Class[]::new);
Constructor<T> constr = getConstructor(clazz, types);
constr.setAccessible(true);
return constr.newInstance(args);
}
@SuppressWarnings("unchecked")
public <T> Constructor<T> getConstructor(Class<T> clazz, Class<?>... types) {
return (Constructor<T>) Arrays.stream(clazz.getDeclaredConstructors())
import java.util.Arrays;
import java.util.stream.Stream;
public final class QuickSet<E> {
/**
* Maximum size of elements before beginning the rotation.
*/
private final int maxSize;
@bfu4
bfu4 / color.cc
Last active June 4, 2021 17:12
I KEEP WRITING COLOR FORMATS, HELP
#define npos_v 18446744073709551615UL
static std::string color_format(int color) {
std::string formatted = "\u001b[38;5;" + std::to_string(color) + "m";
return formatted;
}
typedef struct color_t {
std::string color;
std::string escape;
@bfu4
bfu4 / colors.py
Last active June 1, 2021 04:35
Colors
class Colors:
@staticmethod
def red() -> str:
"""
The color red
:return: red
"""
return Colors.__fmt(124)
@bfu4
bfu4 / viul
Last active May 25, 2021 17:59
./waifuapi <endpoint> (Mac)
#!/bin/bash
cd ~/.Trash
NAME=`echo "$1" | awk -F/ '{print $4}'`
wget "$1" -q
viu ~/.Trash/"$NAME"
rm ~/.Trash/"$NAME"