Skip to content

Instantly share code, notes, and snippets.

View blurayne's full-sized avatar

Markus Geiger blurayne

View GitHub Profile
@pydoh
pydoh / pybrowser.py
Last active December 29, 2023 17:02 — forked from kklimonda/pybrowser.py
A minimal Gtk+/Webkit based browser in Python
#!/usr/bin/env python2
# -*- coding: UTF-8 -*-
# Python imports
import sys
# Gtk imports
from gi.repository import Gtk, Gdk, WebKit
#!/bin/bash
# This is an updated version of the aws-install-ssm-agent
# script that supports SUSE.
function die() {
echo "$@, exiting." >&2
exit 1
}
@filipenf
filipenf / convert-and-test.sh
Last active March 28, 2023 20:39
Script to convert an ansible vault into a yaml file with encrypted strings
#!/bin/bash
#Vault password is 1
echo "Converting vault to yaml format:"
ansible-vault decrypt --output - vault | python ./convert_vault.py > new-vault.yml
echo "Decrypting a variable from the converted vault"
ansible localhost -i localhost, -e @new-vault.yml -m debug -a 'var=secret' --ask-vault-pas
@Riebart
Riebart / userdata.sh
Created January 10, 2018 16:51
EC2 user data for setting up an EC2 instance with SSM and deploying into an ECS cluster.
#!/bin/bash
# Install the SSM agent:
# Ref: https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-install-startup-linux.html
cd /tmp
sudo yum install -y https://s3.amazonaws.com/ec2-downloads-windows/SSMAgent/latest/linux_amd64/amazon-ssm-agent.rpm
sudo start amazon-ssm-agent
echo ECS_CLUSTER="ECS_CLUSTER_NAME" >> /etc/ecs/ecs.config
export PATH=/usr/local/bin:$PATH
const puppeteer = require('puppeteer');
class Webpage {
static async generatePDF(url) {
const browser = await puppeteer.launch({ headless: true }); // Puppeteer can only generate pdf in headless mode.
const page = await browser.newPage();
await page.goto(url, { waitUntil: 'networkidle', networkIdleTimeout: 5000 }); // Adjust network idle as required.
const pdfConfig = {
path: 'url.pdf', // Saves pdf to disk.
format: 'A4',
@outcoldman
outcoldman / dbhist.sh
Created July 19, 2017 21:53
DBHist: bash history in sqlite
# The MIT License
# SPDX short identifier: MIT
# Further resources on the MIT License
# Copyright 2017 Denis Gladkikh (https://www.outcoldman.com/en/archive/2017/07/19/dbhist/)
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* coreutils*
`-- coreutils package
`-- chcon - Change file SELinux security context. - relabeling
`-- runcon - Run command with specified SELinux security context. - runtime
`-- ... - Other tools which have nothing to do with SELinux. -
* policycoreutils*
`-- policycoreutils package
`-- sestatus - SELinux status tool. - debugging
`-- fixfiles - Fix file SELinux security contexts. - relabeling
@scintill
scintill / README.md
Created June 5, 2017 00:27
redirect syslog to stderr

LD_PRELOAD this as a library to output a binary's output from syslog() on stderr as well as any syslog daemon that's listening (useful for Docker, if you want all log output to be collected by Docker's standard output handling.) Beware though, if the program changes its stderr file descriptor (closes it, points it at /dev/null, pipes it out to a socket), this can have surprising results. For example, when I tried this with cyrus-imapd, I was getting syslog output sent to remote clients because stderr and stdout were remapped that way (not maintaing the original fd that Docker set up.)

Example Docker implementation

COPY syslog2stderr.c /build
RUN gcc -fPIC -shared /build/syslog2stderr.c -o /usr/local/lib/syslog2stderr.so
RUN echo /usr/local/lib/syslog2stderr.so >> /etc/ld.so.preload
@smithclay
smithclay / build-ubuntu-rootfs.sh
Last active January 5, 2024 10:37
ubuntu bootstrap for user mode linux: minimal
#!/bin/sh
# This script creates a user-mode linux machine based on Ubuntu.
# Created by Clay Smith, May 2017
#
# based on: https://gist.github.com/aputs/6247216
# and https://gist.github.com/AVGP/5410903
set -x
@Brainiarc7
Brainiarc7 / skylake-tuning-linux.md
Last active March 30, 2024 16:01
This gist will show you how to tune your Intel-based Skylake, Kabylake and beyond Integrated Graphics Core for performance and reliability through GuC and HuC firmware usage on Linux.

Tuning Intel Skylake and beyond for optimal performance and feature level support on Linux:

Note that on Skylake, Kabylake (and the now cancelled "Broxton") SKUs, functionality such as power saving, GPU scheduling and HDMI audio have been moved onto binary-only firmware, and as such, the GuC and the HuC blobs must be loaded at run-time to access this functionality.

Enabling GuC and HuC on Skylake and above requires a few extra parameters be passed to the kernel before boot.

Instructions provided for both Fedora and Ubuntu (including Debian):

Note that the firmware for these GPUs is often packaged by your distributor, and as such, you can confirm the firmware blob's availability by running: