Skip to content

Instantly share code, notes, and snippets.

// valac --pkg gtk+-3.0 test_xdg_desktop_portal_wallpaper.vala
namespace org.freedesktop.portal {
[DBus (name = "org.freedesktop.portal.Wallpaper")]
interface Wallpaper : Object {
public abstract GLib.ObjectPath ShowWallpaperPreview (string app_id, string uri) throws GLib.Error;
public abstract GLib.ObjectPath SetWallpaper (string app_id, string uri) throws GLib.Error;
}
}
@felipeborges
felipeborges / 0001-Correct-the-usage-of-the-GObject-boilerplate-macros.patch
Last active June 19, 2017 12:43
This patch should be enough to make it work.
From 710b85a3ebabc98127c4d7ce7345caec05e26e20 Mon Sep 17 00:00:00 2001
From: Felipe Borges <felipeborges@gnome.org>
Date: Mon, 19 Jun 2017 14:42:42 +0200
Subject: [PATCH] Correct the usage of the GObject boilerplate macros
---
backend/gcp.h | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/backend/gcp.h b/backend/gcp.h
@felipeborges
felipeborges / google.py
Created June 15, 2017 14:22
Get Google API credentials from GNOME Online Accounts
import gi
gi.require_version('Goa', '1.0')
from gi.repository import Goa
def main(args):
client = Goa.Client.new_sync (None)
accounts = client.get_accounts ()
const Gtk = imports.gi.Gtk;
const Lang = imports.lang;
const Poppler = imports.gi.Poppler;
const FILE_NAME = 'file:///home/fborges/Documents/test.pdf';
const PrintOperationExample = new Lang.Class({
Name: 'PrintOperationExample',
Extends: Gtk.Application,
from gi.repository import Gtk, Gdk;
css = """
#MyWindow {
background-color: rgba(0, 0, 0, 0);
}
"""
overlay = Gtk.Overlay();
@felipeborges
felipeborges / lastfm-shout.py
Created July 4, 2015 05:08
Send a message to a user on Last.fm using Goa credentials
from gi.repository import Goa
from md5 import md5
import sys
import requests
if len(sys.argv) < 3:
print "Usage: %s USER [MESSAGE]" % sys.argv[0]
sys.exit()
user = sys.argv[1]
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import threading
from time import sleep
import requests
import simplejson
TELEGRAM_URL = "https://api.telegram.org/bot"
TOKEN = "123196750:AAFEMEjN7S-Fc-J283jZ8JQqZnZ5xTSCW6c"
def crazy_pow(i):
a = i - 25
b = 50 - i
return a*100 + b*b
for i in range(-100, 10000):
x = crazy_pow(i)
print("%d - %d expected = %d" % (i, x, i**2))
<?php
$d = dir(".");
echo "Handle: " . $d->handle . "\n";
echo "Path: " . $d->path . "\n";
while (false !== ($entry = $d->read())) {
echo $entry."\n";
}
$d->close();
?>

Keybase proof

I hereby claim:

  • I am felipeborges on github.
  • I am felipeborges (https://keybase.io/felipeborges) on keybase.
  • I have a public key whose fingerprint is 9B60 FE79 47F0 A3C5 8136 817F 2C2A 2187 42E0 16BE

To claim this, I am signing this object: