Skip to content

Instantly share code, notes, and snippets.

View originalsouth's full-sized avatar
🧭
0x686F6D6969

originalsouth

🧭
0x686F6D6969
View GitHub Profile
@originalsouth
originalsouth / cm.zsh
Last active May 17, 2017 09:18
Launch a bunch of tasks concurrently
#!/bin/env zsh
TASKS="${TASKS:=100}"
CONCURRENCY="${CONCURRENCY:=8}"
main()
{
for t in `seq $TASKS`
do
$@ $t &
while [ $(ps --no-headers -o pid --ppid=$$ | wc -w) -gt $CONCURRENCY ]
do
@originalsouth
originalsouth / mm.zsh
Last active May 16, 2017 11:56
"mailman send an email to ... when program this program/simulation is done"
#!/usr/bin/env zsh
TO=root@localhost #EMAIL address of the recipient
HOST=127.0.0.1 #HOSTNAME with SSMTP service
main()
{
START=$(date +%s)
STARTT="$(date)"
OUT="$(mktemp mm.XXXXXXXXXX)"
echo "##[mm]: launched in folder $(pwd) with pid $$" > $OUT
echo "##[mm] received output:" >> $OUT
@cryzed
cryzed / fix-infinality.md
Last active September 3, 2025 06:53
A set of instructions on how to fix the harfbuzz + Infinality issue and restoring good-looking, Infinality-like font rendering.

Disclaimer: Please follow this guide being aware of the fact that I'm not an expert regarding the things outlined below, however I made my best attempt. A few people in IRC confirmed it worked for them and the results looked acceptable.

Attention: After following all the steps run gdk-pixbuf-query-loaders --update-cache as root, this prevents various gdk-related bugs that have been reported in the last few hours. Symptoms are varied, and for Cinnamon the DE fails to start entirely while for XFCE the icon theme seemingly can't be changed anymore etc.

Check the gist's comments for any further tips and instructions, especially if you are running into problems!

Screenshots

Results after following the guide as of 11.01.2017 13:08:

@bkaradzic
bkaradzic / orthodoxc++.md
Last active January 14, 2026 10:51
Orthodox C++

Orthodox C++

This article has been updated and is available here.

@matovitch
matovitch / pickset.hpp
Last active October 2, 2024 23:25
container with O(1) insertion, deletion, and pick random
#include <vector>
#include <random>
#include <cstddef>
#include <functional>
#include <unordered_set>
template <typename T, typename H = std::hash<T> >
struct Hasher
{
std::size_t operator()(const T* const pt) const
@clemsos
clemsos / color_pages_pdf.sh
Created July 29, 2014 10:09
Count color and B&W pages in a PDF
#!/bin/bash
file="$1"
colorpages=0
# count all pages
totalpages=$(gs -q -dNODISPLAY -c "($1) (r) file runpdfbegin pdfpagecount = quit")
echo "Total pages : $totalpages"
# find pages with colors
for page in $(identify -density 12 -format '%p ' "$file") ; do
@larsimmisch
larsimmisch / crc64.py
Created April 1, 2014 14:53
crc64 implementation in Python (slow)
from __future__ import print_function
# Portions Copyright (c) 1996-2001, PostgreSQL Global Development Group
# (Any use permitted, subject to terms of PostgreSQL license; see.)
# If we have a 64-bit integer type, then a 64-bit CRC looks just like the
# usual sort of implementation. (See Ross Williams' excellent introduction
# A PAINLESS GUIDE TO CRC ERROR DETECTION ALGORITHMS, available from
# ftp://ftp.rocksoft.com/papers/crc_v3.txt or several other net sites.)
@pabigot
pabigot / rotate.cc
Created November 19, 2013 18:52
C++11 template function to perform integer rotations without invoking undefined behavior. See http://blog.regehr.org/archives/1063
/* See http://blog.regehr.org/archives/1063
*/
#include <type_traits>
#include <cstdint>
#include <limits>
#include <typeinfo>
#ifndef ARGTYPE
#define ARGTYPE uint32_t
#endif /* ARGTYPE */
@lauer
lauer / dllogin
Created April 9, 2013 09:25
DLink rancid module Remember to add the following line to rancid-fe (and a , on the line before) 'dlink' => 'dlrancid', This is tested on a DGS-3427
#! /usr/bin/expect --
##
## patched to accomplish fortinet from nlogin
## in turn patched to accomplish D-Link from fnlogin
## by: Daniel G. Epstein <dan at rootlike.com>
## adapted by: Diego Ercolani <diego.ercolani at ssis.sm>
## further adapted by: Gavin McCullagh <gavin.mccullagh at gcd.ie>
##
## rancid 2.3.6
## Copyright (c) 1997-2009 by Terrapin Communications, Inc.