Skip to content

Instantly share code, notes, and snippets.

View univrsal's full-sized avatar

Alex univrsal

View GitHub Profile
@univrsal
univrsal / README.md
Last active July 10, 2022 11:21
Fix empty subjects for Squirrelmail

Apply with patch functions/mailbox_display.php < empty_subject.patch while in the root directory of the squirrelmail installation

@univrsal
univrsal / json_pretty_printer.hpp
Created November 21, 2020 20:56
Dumb and slow c++ json pretty printer
void indent_json(std::string &json)
{
std::stringstream tmp;
int indent_level = 0;
char prev = 0;
for (auto it = json.begin(); it < json.end(); it++) {
switch (*it) {
case '{':
case '[':
@univrsal
univrsal / bcdl.sh
Created October 21, 2016 18:00
Grab songs from bandcamp
#!/bin/bash
if (( "$#" < 2 )); then
echo "Missing arguments!"
echo "args: [bandcamp album url] [save folder]"
fi
folder=$2
band_camp=( $(curl $1 | grep .mp3) )
title="$(wget $1 -O - | grep \<title\>|sed "s/\<title\>\([^<]*\).*/\1/")"
@univrsal
univrsal / mpdq.c
Last active September 25, 2016 11:30
C program querying the currently playing song in mpd and setting it to the dwm bar (root window title)
#include <mpd/client.h>
#include <mpd/stats.h>
#include <stdlib.h>
#include <unistd.h>
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
static volatile int runFlag = 1;
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Threading;
using System.Windows.Forms;
namespace RussianTextGen
{
class Program
{
@univrsal
univrsal / GuiFactory.java
Last active September 25, 2017 17:17
A small mod adding tooltips for items you're looking at on the ground (using Alt), holding in your hand (using Ctrl) or dragging in the inventory (using shift)
package de.universallp.infotooltip;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraftforge.fml.client.IModGuiFactory;
import java.util.Set;
/**
* Created by universallp on 17.01.2016 13:06.