Skip to content

Instantly share code, notes, and snippets.

View zenatureza's full-sized avatar
😎

Árthur Pinheiro zenatureza

😎
  • Santa Maria, RS
View GitHub Profile
@johnathan-sewell
johnathan-sewell / session-per-web-global.cs
Created September 15, 2011 20:54
Setting up NHibernate session per web request - Global.asax
public static ISessionFactory SessionFactory { get; private set; }
protected void Application_Start()
{
AreaRegistration.RegisterAllAreas();
RegisterGlobalFilters(GlobalFilters.Filters);
RegisterRoutes(RouteTable.Routes);
//Configure NHibernate and create a session factory for the application
var nhibernateConiguration = new NHibernate.Cfg.Configuration();
#!/usr/bin/env python
"""
- read subprocess output without threads using Tkinter
- show the output in the GUI
- stop subprocess on a button press
"""
import logging
import os
import sys
from subprocess import Popen, PIPE, STDOUT
@simlun
simlun / raspi-monitor
Last active June 9, 2024 15:15
Script to enable and disable the HDMI signal of the Raspberry PI
#!/bin/bash -e
# /usr/local/sbin/raspi-monitor
# Script to enable and disable the HDMI signal of the Raspberry PI
# Inspiration: http://www.raspberrypi.org/forums/viewtopic.php?t=16472&p=176258
CMD="$1"
function on {
/opt/vc/bin/tvservice --preferred
@Zearin
Zearin / python_decorator_guide.md
Last active November 17, 2024 12:06
The best explanation of Python decorators I’ve ever seen. (An archived answer from StackOverflow.)

NOTE: This is a question I found on StackOverflow which I’ve archived here, because the answer is so effing phenomenal.


Q: How can I make a chain of function decorators in Python?


If you are not into long explanations, see [Paolo Bergantino’s answer][2].

@alvareztech
alvareztech / LoginActivity.java
Last active March 5, 2024 18:32
Firebase Auth with Facebook a Android application
package tech.alvarez.today;
import android.content.Intent;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.ProgressBar;
import android.widget.Toast;
@MattWoodhead
MattWoodhead / tkinter_progress.py
Created June 11, 2017 17:33
tkinter progress bar example with threading
"""
An examnple of the use of threading to allow simultaneous operations in a
tkinter gui (which is locked to a single thread)
"""
import threading
import tkinter as tk
from tkinter import ttk