Skip to content

Instantly share code, notes, and snippets.

@pudquick
pudquick / framework_constants_via_ctypes.py
Last active September 7, 2022 11:06
Loading a NSString/CFStringRef constant directly from an OS X framework using ctypes - but don't do it this way! Do it the other way!
# You should really be using this one instead, SERIOUS
# https://gist.github.com/pudquick/ac8f22326f095ed2690e
from ctypes import Structure, POINTER, CDLL, c_char_p, c_int32, create_string_buffer
from ctypes.util import find_library
# We build an opaque object pointer class type to safely handle data without inspecting it
class OpaqueType(Structure):
pass
@silviucc
silviucc / how_to_build_kernel_on_Ubuntu.txt
Last active May 26, 2021 07:15
Easy way to build a mainline kernel on Ubuntu
Compiling a Linux kernel on Ubuntu
----------------------------------
This should be useful in the event that the user wants to investigate whether a newer kernel allows
certain peripherals to work better (or at all) or some other problems they might encounter while using
the kernel officially provided by Canonical.
As an example, I use the 4.1.5 release from kernel.org.
1) Make sure you have the build environment set up first:
@mattiaslundberg
mattiaslundberg / Ansible Let's Encrypt Nginx setup
Last active May 14, 2025 21:35
Let's Encrypt Nginx setup with Ansible
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@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.

@PatMartin
PatMartin / .block
Last active May 6, 2018 22:07
Dendrogram
license: mit
@roadrunner2
roadrunner2 / 0 Linux-On-MBP-Late-2016.md
Last active May 19, 2025 18:08
Linux on MacBook Pro Late 2016 and Mid 2017 (with Touchbar)

Introduction

This is about documenting getting Linux running on the late 2016 and mid 2017 MPB's; the focus is mostly on the MacBookPro13,3 and MacBookPro14,3 (15inch models), but I try to make it relevant and provide information for MacBookPro13,1, MacBookPro13,2, MacBookPro14,1, and MacBookPro14,2 (13inch models) too. I'm currently using Fedora 27, but most the things should be valid for other recent distros even if the details differ. The kernel version is 4.14.x (after latest update).

The state of linux on the MBP (with particular focus on MacBookPro13,2) is also being tracked on https://github.com/Dunedan/mbp-2016-linux . And for Ubuntu users there are a couple tutorials (here and here) focused on that distro and the MacBook.

Note: For those who have followed these instructions ealier, and in particular for those who have had problems with the custom DSDT, modifying the DSDT is not necessary anymore - se

@h4
h4 / env.py
Last active May 6, 2025 12:44
Setup alembic to work properly with PostgreSQL schemas
from __future__ import with_statement
from alembic import context
from sqlalchemy import engine_from_config, pool
from logging.config import fileConfig
from models import Base
config = context.config
fileConfig(config.config_file_name)
@albfan
albfan / gtk3-theme-switch
Created January 12, 2018 17:07
gtk3 theme switcher
#!/bin/bash
# script to config gtk theme
GTK_VERSION=3
TWEAK_APP=lxappearance
# paths
user_home=/home/${USER}
theme_name=$@ # all arguments....
FROM jwilder/nginx-proxy:alpine
COPY proxy.conf /etc/nginx/conf.d/
@maxidorius
maxidorius / notes.md
Last active November 16, 2023 00:05
Notes on privacy and data collection of Matrix.org

Notes on privacy and data collection of Matrix.org


This version of the document is no longer canonical. You can find the canonical version hosted at Gitlab and Github.

PART 2 IS OUT, INCLUDING THE DISCLOSURE OF A GLOBAL FEDERATION DATA LEAK, AND THE ANATOMY OF A GDPR DATA REQUEST HANDLED BY MATRIX.ORG. SEE THE REPOS ABOVE.