Skip to content

Instantly share code, notes, and snippets.

View PhilipRoman's full-sized avatar

Philip Roman PhilipRoman

  • Latvia
View GitHub Profile
@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));
@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
@justinian
justinian / linux-x64-nasm-cheatsheet.md
Last active March 26, 2024 20:07
x64 NASM Cheat Sheet

x64 NASM cheat sheet

Registers

64 bit 32 bit 16 bit 8 bit
A (accumulator) RAX EAX AX AL
B (base, addressing) RBX EBX BX BL
C (counter, iterations) RCX ECX CX CL
D (data) RDX EDX DX DL
@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!@#$%^&*()_+{}:\"<>?~|]/);
@romainl
romainl / colorscheme-override.md
Last active April 6, 2024 22:42
The right way to override any highlighting if you don't want to edit the colorscheme file directly

The right way to override any highlighting if you don't want to edit the colorscheme file directly

Generalities first

Suppose you have weird taste and you absolutely want:

  • your visual selection to always have a green background and black foreground,
  • your active statusline to always have a white background and red foreground,
  • your very own deep blue background.
@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
@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
@jkomyno
jkomyno / sockaddr_tostr.h
Last active December 20, 2023 00:50
Convert a struct sockaddr address to a string, IPv4 and IPv6
// Convert a struct sockaddr address to a string, IPv4 and IPv6:
char *get_ip_str(const struct sockaddr *sa, char *s, size_t maxlen)
{
switch(sa->sa_family) {
case AF_INET:
inet_ntop(AF_INET, &(((struct sockaddr_in *)sa)->sin_addr),
s, maxlen);
break;
@gbaman
gbaman / HowToOTGFast.md
Last active April 16, 2024 06:29
Simple guide for setting up OTG modes on the Raspberry Pi Zero, the fast way!

Setting up Pi Zero OTG - The quick way (No USB keyboard, mouse, HDMI monitor needed)

More details - http://blog.gbaman.info/?p=791

For this method, alongside your Pi Zero, MicroUSB cable and MicroSD card, only an additional computer is required, which can be running Windows (with Bonjour, iTunes or Quicktime installed), Mac OS or Linux (with Avahi Daemon installed, for example Ubuntu has it built in).
1. Flash Raspbian Jessie full or Raspbian Jessie Lite onto the SD card.
2. Once Raspbian is flashed, open up the boot partition (in Windows Explorer, Finder etc) and add to the bottom of the config.txt file dtoverlay=dwc2 on a new line, then save the file.
3. If using a recent release of Jessie (Dec 2016 onwards), then create a new file simply called ssh in the SD card as well. By default SSH i

radare2

load without any analysis (file header at offset 0x0): r2 -n /path/to/file

  • analyze all: aa
  • show sections: iS
  • list functions: afl
  • list imports: ii
  • list entrypoints: ie
  • seek to function: s sym.main