Skip to content

Instantly share code, notes, and snippets.

View PhilipRoman's full-sized avatar

Philip Roman PhilipRoman

  • Latvia
View GitHub Profile
@kay
kay / hsdis-ubuntu.sh
Last active October 21, 2019 21:16 — forked from zajacmp3/hsdis-ubuntu.sh
Build hsdis for JDK 1.8 on Debian/Ubuntu
sudo apt-get install libgmp-dev libmpfr-dev libmpc-dev g++-multilib mercurial texinfo
hg clone http://hg.openjdk.java.net/jdk8u/jdk8u
cd jdk8u
hg update jdk8u92-b14
sed -ri 's/subrepos="[^"]+"/subrepos="hotspot"/' ./make/scripts/hgforest.sh # only get hotspot
sed -ri 's/subrepos="[^"]+"/subrepos="hotspot"/' ./common/bin/hgforest.sh # only get hotspot
chmod +x ./get_source.sh; ./get_source.sh
cd hotspot/src/share/tools/hsdis
wget http://ftp.heanet.ie/mirrors/ftp.gnu.org/gnu/binutils/binutils-2.29.tar.gz
tar -xzf binutils-2.29.tar.gz
@GestaltEngine
GestaltEngine / box.c
Created November 12, 2021 02:38
Changes rendering of fractions
/* equation boxes */
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "eqn.h"
struct box *box_alloc(int szreg, int pre, int style)
{
struct box *box = malloc(sizeof(*box));
@meetmatt
meetmatt / gist:d5dd2ecae37fbabb483dffba2d6dbec6
Created November 3, 2016 13:33
Show installed packages reverse sorted by size in alpine
apk info | xargs -n1 -I{} apk info -s {} | xargs -n4 | awk '{print $4,$1}' | sort -rn
@bnorm
bnorm / Singleton.java
Created August 23, 2015 13:51
Allows collecting into 1 and only 1 object from a stream. Supports a few different finishing object types.
import java.util.Objects;
import java.util.Optional;
import java.util.StringJoiner;
import java.util.stream.Collector;
import java.util.stream.Collectors;
public class Singleton<T> {
private T value;
private volatile int count;
@97-109-107
97-109-107 / vim_cterm2gui.py
Created June 23, 2015 08:22
convert from ctermfg/ctermbg to guifg/guibg
#!/usr/bin/env python2.7
#based on https://gist.github.com/hhatto/6405956 from hhato
import sys
new_vim_color = []
xtermMap = {
'0': '#000000', '1': '#800000', '2': '#008000', '3': '#808000', '4': '#000080',
'5': '#800080', '6': '#008080', '7': '#c0c0c0', '8': '#808080', '9': '#ff0000',
'10': '#00ff00', '11': '#ffff00', '12': '#0000ff', '13': '#ff00ff', '14': '#00ffff',
@traviskaufman
traviskaufman / logback_disable_in_unit_tests.md
Last active March 20, 2023 08:38
Logback: Disable all logging in unit tests

After scouring the internet and piece-mealing together the correct way to do this, here is a step-by-step, all-in-one-place guide to making logback STFU when running your unit tests.

Here's how to do it

Save the following as logback-test.xml under src/test/resources:

<configuration>
  <appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
    <encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
      <pattern>%msg%n</pattern>
@kirelagin
kirelagin / tmux-magic
Last active November 2, 2023 11:05
tmux magic for OpenRC
###
#
# tmux magic for OpenRC
#
# These functions do some tmux magic to let you run non-daemon programs
# (e.g. ones with ncurses interface) as daemons in tmux sessions.
# You just run `/etc/init.d/<service> start/stop` or add the service
# to a runlevel and later you can do `/etc/init.d/<service> attach` to
# see its console. Type `Ctrl+b d` to detach (in the default tmux configuration).
# We execute tmux with `-L`, so those sessions are not visible in the
@torbiak
torbiak / groff-install-font
Last active November 21, 2023 21:26
Install ttf and otf fonts for use with groff
#!/usr/bin/env bash
# groff-install-ttf converts a TrueType (ttf) or OpenType (otf) font to a
# Printer Font ASCII (pfa) font and a groff font (ditroff) and installs them to
# groff's site-font directory.
#
# Requires fontforge.
#
# You're the best, Peter Schaffter, but contrary to the verbose and
# difficult-to-follow http://www.schaffter.ca/mom/momdoc/appendices.html#fonts,
# the t42 file doesn't seem to be necessary, at least with recent versions of
@byjg
byjg / NoVNC_Paste.js
Last active November 24, 2023 05:46
How to Paste code to NoVNC.
// This will open up a prompt for text to send to a console session on digital ocean
// Useful for long passwords
(function () {
window.sendString = function (str) {
f(str.split(""));
function f(t) {
var character = t.shift();
var i=[];
var code = character.charCodeAt();
var needs_shift = character.match(/[A-Z!@#$%^&*()_+{}:\"<>?~|]/);
@yohhoy
yohhoy / threads.h
Last active December 6, 2023 00:35
C11 <threads.h> emulation library
/*
* C11 <threads.h> emulation library
*
* (C) Copyright yohhoy 2012.
* Distributed under the Boost Software License, Version 1.0.
* (See copy at http://www.boost.org/LICENSE_1_0.txt)
*/
#ifndef EMULATED_THREADS_H_INCLUDED_
#define EMULATED_THREADS_H_INCLUDED_