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 / modals.html
Created December 4, 2014 20:36
Resolve Conflicts UI Frameworks - Modal Bootstrap and Semantic
<html>
<head>
<title>Resolve Conflicts UI Frameworks</title>
<!-- styles -->
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.1/css/bootstrap.min.css" />
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/semantic-ui/1.0.1/semantic.min.css" />
</head>
<body>
@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 / PKGBUILD
Created February 12, 2015 21:02
PKGBUILD example to use in AUR
pkgname=kcenter
pkgver=0.0.1
pkgrel=1
pkgdesc="A system configuration for KDE"
arch=('i686' 'x86_64')
url="http://www.kaiana.com.br/"
license=('GPLv2')
depends=('python', 'python-pyqt5', 'qt5-webkit', 'python-xdg', )
source=('https://github.com/kaiana/${pkgname}/archive/${pkgver}.tar.gz')
md5sums=('6a676c12910d0ca2cd2c9a55d954fce4df385f1e')
@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 / post-receive
Created April 28, 2016 19:53 — forked from geekforbrains/post-receive
Git post-receive rsync to remote server
#!/bin/bash
REPO=NAME_HERE
# Dir paths on remote server
# These are associated with branches within a git project
LIVE_BRANCH="master"
LIVE="git@host:/var/www/live/"
STAGE_BRANCH="develop"
STAGE="git@host:/var/www/stage/"
@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)'