Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
import os
pacman_path = "/var/lib/pacman/local"
pkgs = []
class bcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
@NBonaparte
NBonaparte / eu4_filter.py
Last active June 28, 2020 20:31
generates new page from eu4 achievements wiki page with unlocked achievements hidden
# NOTE: Game Details setting on Steam must be public
# Replace key and steamID values with your own api key (from https://steamcommunity.com/dev/apikey) and Steam ID.
from datetime import datetime
import requests
from bs4 import BeautifulSoup
# get currently unlocked achievements
key = "0"
steamID = 0
appID = 236850
@NBonaparte
NBonaparte / pacsize.rs
Created April 28, 2020 21:59
gets arch package sizes and sorts in increasing order
use std::error::Error;
use std::fs::{File, read_dir};
use std::io::{BufRead, BufReader};
use std::cmp::Ordering;
use std::fmt;
#[derive(Eq)]
struct Package {
name: String,
size: usize,
@NBonaparte
NBonaparte / xcb.zig
Created May 11, 2019 05:24
Minimal XCB + Cairo example in Zig
const c = @cImport({
@cInclude("xcb/xcb.h");
@cInclude("cairo/cairo-xcb.h");
@cInclude("cairo/cairo.h");
});
const std = @import("std");
pub fn lookup_visual(s: *c.xcb_screen_t, visual: c.xcb_visualid_t) ?*c.xcb_visualtype_t {
var d = c.xcb_screen_allowed_depths_iterator(s);
while (d.rem != 0) {
@NBonaparte
NBonaparte / mouse2arrow.c
Created September 7, 2018 22:20
Simple program to translate mouse movements to arrow keys with libxdo
#include <xdo.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdbool.h>
#include <time.h>
static bool x_axis, y_axis;
static const char *up = "Up";
static const char *down = "Down";
static const char *left = "Left";
static const char *right = "Right";
@NBonaparte
NBonaparte / gst-camera-record
Last active August 17, 2023 14:26
Python 3 program using Gstreamer 1.0 that shows video stream and allows for uninterrupted recording.
#!/usr/bin/python3
# This program is licensed under GPLv3.
from os import path
import gi
gi.require_version('Gst', '1.0')
gi.require_version('Gtk', '3.0')
gi.require_version('GdkX11', '3.0')
gi.require_version('GstVideo', '1.0')
from gi.repository import GObject, Gst, Gtk