Skip to content

Instantly share code, notes, and snippets.

View NorimasaNabeta's full-sized avatar
🌴
On vacation

Norimasa Nabeta NorimasaNabeta

🌴
On vacation
View GitHub Profile
@munificent
munificent / generate.c
Last active May 7, 2024 06:19
A random dungeon generator that fits on a business card
#include <time.h> // Robert Nystrom
#include <stdio.h> // @munificentbob
#include <stdlib.h> // for Ginny
#define r return // 2008-2019
#define l(a, b, c, d) for (i y=a;y\
<b; y++) for (int x = c; x < d; x++)
typedef int i;const i H=40;const i W
=80;i m[40][80];i g(i x){r rand()%x;
}void cave(i s){i w=g(10)+5;i h=g(6)
+3;i t=g(W-w-2)+1;i u=g(H-h-2)+1;l(u
@joyeusenoelle
joyeusenoelle / Mastodon.md
Last active January 23, 2024 02:43
An increasingly less-brief introduction to Mastodon
@JPvRiel
JPvRiel / linux_memory_control_to_avoid_swap_thrashing.md
Created November 7, 2016 22:29
Notes on linux memory management options to prioritize and control memory access using older ulimits, newer cgroups and overcommit policy settings. Mostly as an attempt to keep a desktop environment responsive and avoid swap thrashing under high memory pressure.

Overview

Some notes about:

  • Explaining why current day Linux memory swap thrashing still happens (as of 2016).
  • Mitigating "stop the world" type thrashing issues on a Linux workstation when it's under high memory pressure and where responsiveness is more important than process completion.
  • Prioritizing and limiting memory use.
  • Older ulimit versus newer CGroup options.

These notes assume some basic background knowledge about memory management, ulimits and cgroups.

@QuantumGhost
QuantumGhost / example.puml
Last active March 23, 2024 22:39
A simple template for PlantUML to draw ER diagram.The basic idea comes from http://plantuml.sourceforge.net/qa/?qa=331/database-modeling
@startuml
' uncomment the line below if you're using computer with a retina display
' skinparam dpi 300
!define Table(name,desc) class name as "desc" << (T,#FFAAAA) >>
' we use bold for primary key
' green color for unique
' and underscore for not_null
!define primary_key(x) <b>x</b>
!define unique(x) <color:green>x</color>
!define not_null(x) <u>x</u>
@maoueh
maoueh / msys2_cross_compiler_for_rpi.md
Last active January 16, 2022 17:49
Build steps to create a (cross-)compiler creating native code executable targeting raspberry pi (RPi), running on MSYS2 and using MSYS2 to compile the cross-compiler

Build Steps

This document details extra that were needed to build the rpi cross-compiler on MSYS2. The original instructions are located on gurucodings.

This cross-compiler has been created targeting the Raspbian Wheezy OS which is based on Debian Wheezy with special support for the Raspberry PI architecture. The version that was installed on my rpi is 2014-06-20-wheezy-raspbian.

Here the version of the various tools currently present in this version of Raspbian (Guest OS):

  • gcc (Debian 4.6.3-14+rpi1) 4.6.3
  • GNU ld (GNU Binutils for Debian) 2.22
@samhocevar
samhocevar / gist:00eec26d9e9988d080ac
Last active January 13, 2024 23:40
Configure sshd on MSYS2 and run it as a Windows service
#!/bin/sh
#
# msys2-sshd-setup.sh — configure sshd on MSYS2 and run it as a Windows service
#
# Please report issues and/or improvements to Sam Hocevar <sam@hocevar.net>
#
# Prerequisites:
# — MSYS2 itself: http://sourceforge.net/projects/msys2/
# — admin tools: pacman -S openssh cygrunsrv mingw-w64-x86_64-editrights
#
@favadi
favadi / build-emacs.sh
Last active June 5, 2021 15:25
Compile latest emacs version (24.5) in Ubuntu 14.04
#!/bin/bash
# Build latest version of Emacs, version management with stow
# OS: Ubuntu 14.04 LTS
# version: 24.5
# Toolkit: lucid
# Warning, use updated version of this script in: https://github.com/favadi/build-emacs
set -e
@kevinkreiser
kevinkreiser / logging.hpp
Last active April 17, 2024 13:25
Thread-safe logging singleton c++11
#ifndef __LOGGING_HPP__
#define __LOGGING_HPP__
/*
Test this with something like:
g++ -std=c++11 -x c++ -pthread -DLOGGING_LEVEL_ALL -DTEST_LOGGING logging.hpp -o logging_test
./logging_test
*/
#include <string>
@julianchurchill
julianchurchill / checkJenkins.sh
Last active December 20, 2022 09:10
A bash script to query a Jenkins server. Use like this: 'checkJenkins.sh <jobname>' and it will query the server with the given job name every 30s. Use like this: 'checkJenkins.sh <jobname> tmux' and it will query the server once and output tmux coloured messages appropriate to display in a tmux status bar. E.g. add this to your .tmux.conf 'set …
#!/bin/bash
CONSOLE_RED="\033[2;31m"
CONSOLE_GREEN="\033[2;32m"
CONSOLE_CLEAR="\033[0m"
JENKINS_SERVER=http://my_jenkins_server
JOB=$1
JOB_QUERY=/job/${JOB}
@yahyaKacem
yahyaKacem / string_converter.py
Created December 29, 2013 13:51
Convert camel-case to snake-case in python. e.g.: CamelCase -> snake_case e.g.: snake_case -> CamelCase e.g.: CamelCase -> dash-case e.g.: dash-case -> CamelCase By: Jay Taylor [@jtaylor] Me<modifier>: Yahya Kacem <fuj.tyoli@gmail.com> Original gist: https://gist.github.com/jaytaylor/3660565
#!/usr/bin/env python
"""
Convert camel-case to snake-case in python.
e.g.: CamelCase -> snake_case
e.g.: snake_case -> CamelCase
e.g.: CamelCase -> dash-case
e.g.: dash-case -> CamelCase
By: Jay Taylor [@jtaylor]
Me<modifier>: Yahya Kacem <fuj.tyoli@gmail.com>
Original gist: https://gist.github.com/jaytaylor/3660565