Skip to content

Instantly share code, notes, and snippets.

View mikkorantalainen's full-sized avatar

Mikko Rantalainen mikkorantalainen

  • Peda.net, University of Jyväskylä
  • Finland
View GitHub Profile
@tcpdump-examples
tcpdump-examples / iowait-linux.md
Created March 21, 2021 11:40
How to Fix io wait issue in Linux

Linux high IOwait is a common Linux performance issue. Today we will look at what iowait means and what contributes to this problem. Hope this can give you more ideas about high IOwait issue.

What is IOwait?

IO wait is related to the CPU resource on the server.

The iowait column on top command output shows the percentage of time that the processor was waiting for I/O to complete. It indicates that the system is waiting on disk or network IO. Because the system is waiting on those resources, it can not fully utilize the CPU.

Learn more about what IOwait here.

@probonopd
probonopd / Wayland.md
Last active November 15, 2024 01:20
Think twice about Wayland. It breaks everything!

Think twice before abandoning Xorg. Wayland breaks everything!

Hence, if you are interested in existing applications to "just work" without the need for adjustments, then you may be better off avoiding Wayland.

Wayland solves no issues I have but breaks almost everything I need. Even the most basic, most simple things (like xkill) - in this case with no obvious replacement. And usually it stays broken, because the Wayland folks mostly seem to care about Automotive, Gnome, maybe KDE - and alienating everyone else (e.g., people using just an X11 window manager or something like GNUstep) in the process.

The Wayland project seems to operate like they were starting a greenfield project, whereas at the same time they try to position Wayland as "the X11 successor", which would clearly require a lot of thought about not breaking, or at least providing a smooth upgrade path for, existing software.

In fact, it is merely an incompatible alternative, and not e

@Sturtuk
Sturtuk / extract_mapjs.php
Created June 24, 2020 02:44
Extract source code & directories from the javascript .map files
<?php
/**
* Created by PhpStorm.
* User: edwinsturt
* Date: 2020-06-24
* Time: 00:45
*/
$file = 'main.ff0058ad.js.map';

Non-lib patches

diff -r original/AndroidManifest.xml mod/AndroidManifest.xml
17c17
<     <application android:allowBackup="false" android:appComponentFactory="androidx.core.app.CoreComponentFactory" android:extractNativeLibs="false" android:icon="@mipmap/ic_launcher" android:label="@string/application_name" android:largeHeap="true" android:name="com.sonymobile.scan3d.Scan3DApp" android:networkSecurityConfig="@xml/network_security_config" android:resizeableActivity="false" android:supportsRtl="true">
---
>     <application android:allowBackup="false" android:appComponentFactory="androidx.core.app.CoreComponentFactory" android:extractNativeLibs="true" android:icon="@mipmap/ic_launcher" android:label="@string/application_name" android:largeHeap="true" android:name="com.sonymobile.scan3d.Scan3DApp" android:networkSecurityConfig="@xml/network_security_config" android:resizeableActivity="false" android:supportsRtl="true">
22c22
<         <uses-library android:name="com.sony.device" android:required="true"/>
-
@jigpu
jigpu / wacom_app_config.sh
Last active January 31, 2022 16:32
Apply application-specific profiles with xsetwacom on Linux
#!/bin/bash
# wacom_app_config.sh
#
# BASH script to automatically run change Wacom driver config
# based on the focused application.
#
# Limited support for use under GNOME and its forks due to the
# way it does its own device/took configuration, but should work
# fine elsewhere. It may be possible to use the power of dconf
@supix
supix / postgres_recovery.md
Last active June 6, 2024 18:46
Postgres error: Missing chunk 0 for toast value in pg_toast

The problem

In some cases, it is possible that PostgreSQL tables get corrupted. This can happen in case of hardware failures (e.g. hard disk drives with write-back cache enabled, RAID controllers with faulty/worn out battery backup, etc.), as clearly reported in this wiki page. Furthermore, it can happen in case of incorrect setup, as well.

One of the symptoms of such corruptions is the following message:

ERROR: missing chunk number 0 for toast value 123456 in pg_toast_45678

This almost surely indicates that a corrupted chunk is present within a table file. But there is a good way to get rid of it.

@vi
vi / cgroup_memory_pressure_monitor.c
Created July 19, 2015 22:51
Simple command-line tool use cgroup's memory.pressure_level
#include <sys/eventfd.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdint.h>
#include <string.h>
#include <errno.h>
#include <fcntl.h>
// Implemented by Vitaly "_Vi" Shukela in 2015, License=MIT.
@ejdyksen
ejdyksen / patch-edid.md
Last active October 31, 2024 20:52
A script to fix EDID problems on external monitors in macOS

patch-edid.rb

A script to fix EDID problems on external monitors in macOS.

Instructions

  1. Connect only the problem display.

  2. Create this directory structure (if it doesn't already exist):

@troyk
troyk / pg_stat_statements
Created January 5, 2013 18:18
enable postgres pg_stat_statements
1) see re: increasing shmmax http://stackoverflow.com/a/10629164/1283020
2) add to postgresql.conf:
shared_preload_libraries = 'pg_stat_statements' # (change requires restart)
136 pg_stat_statements.max = 1000
137 pg_stat_statements.track = all
3) restart postgres
4) check it out in psql
@AngryLoki
AngryLoki / ies2cycles.py
Last active January 30, 2024 16:47
IES to Cycles addon for new nodetree system! It only works for trunk builds of blender 2.66 and later versions!!! Thread on blenderartists.org: http://blenderartists.org/forum/showthread.php?276063 Old outdated version (no rig) for official 2.66 release (old nodetrees): https://gist.github.com/Lockal/5313485
# ##### BEGIN GPL LICENSE BLOCK #####
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the