This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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 | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
↳ 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <glib.h> | |
static void | |
try_pack_and_unpack (gint64 number) | |
{ | |
gint64 number_unpacked; | |
guint32 number_high; | |
guint32 number_low; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* 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` | |
**/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
set -o xtrace | |
if [[ $EUID -ne 0 ]]; then | |
echo "This script must be run as root" | |
exit 1 | |
fi |
NewerOlder