Skip to content

Instantly share code, notes, and snippets.

View mwleeds's full-sized avatar

Phaedrus Leeds mwleeds

View GitHub Profile
#include <glib.h>
#include <gio/gio.h>
#include <stdio.h>
static void
changed_cb (GFileMonitor *m,
GFile *f,
GFile *f2,
GFileMonitorEvent event_type,
gpointer user_data)
#include <libportal/portal.h>
#include <glib.h>
#include <stdio.h>
int main(int argc, char **argv) {
g_autoptr(GError) error = NULL;
gboolean flatpak = xdp_portal_running_under_flatpak ();
gboolean snap = xdp_portal_running_under_snap (&error);
gboolean sandbox = xdp_portal_running_under_sandbox ();
printf ("flatpak = %d, snap = %d, sandbox = %d\n", (int) flatpak, (int) snap, (int) sandbox);
printf ("snap error = %s\n", error ? error->message : "none");
%global bubblewrap_version 0.5.0
%global ostree_version 2020.8
Name: flatpak
Version: 1.12.6
Release: 1%{?dist}
Summary: Application deployment framework for desktop apps
License: LGPLv2+
URL: http://flatpak.org/
from collections import deque
import random
import os
class Card:
def __init__(self, suit, val):
self.suit = suit
self.value = val
# good practice is to include repr and str magic methods - that way you can print meaningful info
#include <stdio.h>
/* copied from libsoup */
/* 00 URI_UNRESERVED
* 01 URI_PCT_ENCODED
* 02 URI_GEN_DELIMS
* 04 URI_SUB_DELIMS
* 08 HTTP_SEPARATOR
* 10 HTTP_CTL
*/
↳ wget http://repository.spotify.com/pool/non-free/s/spotify-client/spotify-client_1.1.26.501.gbe11e53b-15_amd64.deb
--2020-03-04 12:01:53-- http://repository.spotify.com/pool/non-free/s/spotify-client/spotify-client_1.1.26.501.gbe11e53b-15_amd64.deb
Resolving repository.spotify.com (repository.spotify.com)... 13.227.77.222, 13.227.77.65, 13.227.77.43, ...
Connecting to repository.spotify.com (repository.spotify.com)|13.227.77.222|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 120102446 (115M) [application/octet-stream]
Saving to: ‘spotify-client_1.1.26.501.gbe11e53b-15_amd64.deb’
spotify-client_1.1. 26%[====> ] 30.13M 8.34MB/s in 4.6s
#!/usr/bin/env python3
from gi import require_version
require_version('Flatpak', '1.0')
from gi.repository import Flatpak
inst = Flatpak.Installation.new_user()
inst.install_full(flags=Flatpak.InstallFlags.NONE, remote_name="flathub", kind=Flatpak.RefKind.APP, name="org.gnome.Chess", arch="x86_64",branch="stable",subpaths=None)
#include <stdio.h>
#include <glib.h>
static void
try_pack_and_unpack (gint64 number)
{
gint64 number_unpacked;
guint32 number_high;
guint32 number_low;
/* Test whether the adjtime() system call used by NTP affects the length of
* each CLOCK_BOOTTIME second (rather than just the length of each
* CLOCK_REALTIME second) by printing the value of CLOCK_BOOTTIME once every
* second, using a CLOCK_BOOTTIME timer. You're expected to get NTP to do
* adjustments externally. boottime-source.c and boottime-source.h are from
* https://github.com/endlessm/eos-payg
* Here are the compile commands used:
* gcc -c boottime-source.c `pkg-config --cflags --libs glib-2.0`
* gcc test-boottime-adjtime.c boottime-source.o `pkg-config --cflags --libs glib-2.0 gio-2.0`
**/
#!/bin/bash
set -e
set -o xtrace
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root"
exit 1
fi