Skip to content

Instantly share code, notes, and snippets.

View hypothermic's full-sized avatar

hypothermic hypothermic

View GitHub Profile
@jsok
jsok / sqlite3_test.c
Created June 15, 2012 14:34
sqlite3 C example
#include <stdio.h>
#include <sqlite3.h>
int main(void)
{
sqlite3 *db;
sqlite3_stmt *stmt;
sqlite3_open("expenses.db", &db);
@jashkenas
jashkenas / semantic-pedantic.md
Last active July 13, 2024 04:25
Why Semantic Versioning Isn't

Spurred by recent events (https://news.ycombinator.com/item?id=8244700), this is a quick set of jotted-down thoughts about the state of "Semantic" Versioning, and why we should be fighting the good fight against it.

For a long time in the history of software, version numbers indicated the relative progress and change in a given piece of software. A major release (1.x.x) was major, a minor release (x.1.x) was minor, and a patch release was just a small patch. You could evaluate a given piece of software by name + version, and get a feeling for how far away version 2.0.1 was from version 2.8.0.

But Semantic Versioning (henceforth, SemVer), as specified at http://semver.org/, changes this to prioritize a mechanistic understanding of a codebase over a human one. Any "breaking" change to the software must be accompanied with a new major version number. It's alright for robots, but bad for us.

SemVer tries to compress a huge amount of information — the nature of the change, the percentage of users that wil

@dpryden
dpryden / ClassLoaderLeakExample.java
Created October 20, 2014 00:01
Example of a ClassLoader leak in Java
import java.io.IOException;
import java.net.URLClassLoader;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.nio.file.Path;
/**
* Example demonstrating a ClassLoader leak.
*
* <p>To see it in action, copy this file to a temp directory somewhere,
@bhanuc
bhanuc / hello.glade
Last active January 10, 2023 10:19
Minimal gnome hello world using glade + gjs
<?xml version="1.0" encoding="UTF-8"?>
<!-- Generated with glade 3.18.3 -->
<interface>
<requires lib="gtk+" version="3.12"/>
<template class="Gjs_AppWindow" parent="GtkApplicationWindow">
<property name="can_focus">False</property>
<property name="title" translatable="yes">gnome-hello</property>
<property name="window_position">center</property>
<property name="default_width">200</property>
<property name="default_height">100</property>
@mcjohnalds
mcjohnalds / how-to-do-error-reporting-in-glib.md
Created May 12, 2016 12:25
Here's how to do error reporting in GLib

How to do error reporting in GLib

C doesn't support exceptions but GLib has its own error reporting system. It's kind of verbose but it works ok.

Let's pretend we were making a JSON parser library, here's how the error reporting would work. (This example was actually derived from json-glib).

First we create an enum to represent different error codes.

machine_name : "eMMC Transfer Mode";
machine_version : 1.0.0;
machine_reference : ["https://www.design-reuse.com/news_img/20101001_2.gif",
"https://www.design-reuse.com/articles/24546/functional-fsm-paths-coverage-systemverilog.html"];
machine_author : "John Haugeland <stonecypher@gmail.com>";
machine_license : MIT;
jssm_version : >= 5.0.0;
graph_layout : dot;
@huntrar
huntrar / full-disk-encryption-arch-uefi.md
Last active July 13, 2024 08:35
Arch Linux Full-Disk Encryption Installation Guide [Encrypted Boot, UEFI, NVMe, Evil Maid]

Arch Linux Full-Disk Encryption Installation Guide

This guide provides instructions for an Arch Linux installation featuring full-disk encryption via LVM on LUKS and an encrypted boot partition (GRUB) for UEFI systems.

Following the main installation are further instructions to harden against Evil Maid attacks via UEFI Secure Boot custom key enrollment and self-signed kernel and bootloader.

Preface

You will find most of this information pulled from the Arch Wiki and other resources linked thereof.

Note: The system was installed on an NVMe SSD, substitute /dev/nvme0nX with /dev/sdX or your device as needed.

@AnatomicJC
AnatomicJC / android-backup-apk-and-datas.md
Last active July 18, 2024 22:51
Backup android app, data included, no root needed, with adb

Backup android app, data included, no root needed, with adb

Note: This gist may be outdated, thanks to all contributors in comments.

adb is the Android CLI tool with which you can interact with your android device, from your PC

You must enable developer mode (tap 7 times on the build version in parameters) and install adb on your PC.

Don't hesitate to read comments, there is useful tips, thanks guys for this !

@revant
revant / README.md
Last active July 16, 2022 08:46
Arch Linux on Lenovo IdeaPad 330-15ARR

Required Kernel params

loglevel=3 iommu=pt acpi_backlight=native
  • iommu=pt Solves sudden freeze of graphics Arch Forum Link
  • acpi_backlight=native Solves back light "failed" message during boot Arch Wiki
  • Use it with other params e.g. loglevel=3 iommu=pt acpi_backlight=native apparmor=1 security=apparmor quiet
@NeRdTheNed
NeRdTheNed / Forge1.2.5WorkspaceGuide.md
Last active July 16, 2024 07:20
How to set up a functional Forge 1.2.5 workspace in 2020.

How to set up a Forge 1.2.5 workspace in 2020 & above.

Automatic script (recommended)

I've created a bash script that sets up Forge 1.2.5, which you can find here! It automatically does each step of this guide for you, and includes a fix for sounds.

Manual setup

TODO: Add a section on installing the resources (sounds) folder to the MCP environment. The links have changed and Minecraft 1.2.5 isn't able to download them anymore.