Skip to content

Instantly share code, notes, and snippets.

View rafael-neri's full-sized avatar
💻
Working from home

Rafael Neri rafael-neri

💻
Working from home
View GitHub Profile
#!/usr/bin/python
# -*- coding: utf-8 -*-
'''
Example: ./kinfoservices --imagesize=32 --fileout=file.txt
'''
import os, sys
from xdg.DesktopEntry import *
from xdg.IconTheme import *
@rafael-neri
rafael-neri / webapps.py
Created June 18, 2014 00:08
Kaiana Webapps
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebKit import QWebSettings
from PyQt5.QtWebKitWidgets import QWebView
from PyQt5.QtCore import QUrl
@rafael-neri
rafael-neri / app.desktop
Created December 26, 2014 14:08
Exemplo de arquivo
[Desktop Entry]
Name=My Applications
Name[es]=Mi aplicacione
Name[pt_BR]=Meu Aplicativo
Comment=My Comment
Comment[es]=Mi comentario
Comment[pt_BR]=Meu comentário
Exec=/usr/bin/app --abc
Icon=preferences-desktop-theme
Categories=XPTO
@rafael-neri
rafael-neri / appinstall.py
Created February 19, 2015 20:25
Instalando aplicativo usando python-apt
#!/usr/bin/env python
# aptinstall.py
import apt
import sys
pkg_name = "firefox"
cache = apt.cache.Cache()
cache.update()
@rafael-neri
rafael-neri / 1-texto.md
Last active June 20, 2016 18:16
padrão fenix

Depois do manifesto dos Programadores Que Se Garantem chegou por aqui um novo Padrão de Projeto.

Note que um padrão de projeto é uma arte. Não são todas as pessoas que sabem usá-los, muito menos entendê-los. Esse padrão é especial, "Padrão Fênix", "Exceção Fenix" ou em inglês e mais chic: Phoenix Exception!

A Phoenix Exception consiste em um sistema que nunca morre, pois assim como a Phoenix, ele sempre renasce das cinzas.

Veja um exemplo da Phoenix Exception.

@rafael-neri
rafael-neri / interface_to_internet.sh
Last active July 13, 2016 18:53
Check Default Interface To Internet
#!/bin/bash
# host we want to "reach"
host=google.com
# get the ip of that host (works with dns and /etc/hosts. In case we get multiple ipaddresses, we just want one of them
host_ip=$(getent ahosts "$host" | head -1 | awk '{print $1}')
# only list the interface used to reach a specific host/IP. We only want the part between dev and src (use grep for that)
ip route get "$host_ip" | grep -Po '(?<=(dev )).*(?= src)'
@rafael-neri
rafael-neri / makedeb.sh
Last active September 14, 2016 14:24
Simple script to create debian package
#!/bin/bash
# Distributed under the GNU GPL
# Check if user is root
if [ "$EUID" -ne 0 ]
then echo "Please run as root"
exit
fi
# Get path
@rafael-neri
rafael-neri / pac_aliases
Created March 9, 2017 16:24 — forked from rroblak/pac_aliases
Package manager-independent bash aliases
# paci - install one or more packages
# pacu - upgrade all packages to their newest version
# pacr - uninstall one or more packages
# pacs - search for a package using one or more keywords
# pacinfo - show information about a package
# pacinstalled - show if a package is installed
# paca - list all installed packages
# paclo - list all packages which are orphaned
# pacdnc - delete all not currently installed package files
# pacfiles - list all files installed by a given package
@rafael-neri
rafael-neri / teste.py
Last active May 30, 2017 18:11
Example Python3 + QT5 + Web
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import os
import sys
from PyQt5.QtWidgets import QApplication
from PyQt5.QtWebKitWidgets import QWebView
from PyQt5.QtGui import QIcon
from PyQt5.QtCore import QUrl
from PyQt5.QtCore import QSize