Skip to content

Instantly share code, notes, and snippets.

View gilsondev's full-sized avatar
💼
Work

Gilson Filho gilsondev

💼
Work
View GitHub Profile
@kissgyorgy
kissgyorgy / sqlalchemy_conftest.py
Last active April 21, 2025 11:44
Python: py.test fixture for SQLAlchemy test in a transaction, create tables only once!
from sqlalchemy import create_engine
from sqlalchemy.orm import Session
from myapp.models import BaseModel
import pytest
@pytest.fixture(scope="session")
def engine():
return create_engine("postgresql://localhost/test_database")
@chaeplin
chaeplin / _01.temp_sensor_01.ino
Last active June 24, 2024 18:48
esp8266+dht22+mqtt
// Code based on
// https://github.com/adafruit/DHT-sensor-library/blob/master/examples/DHTtester/DHTtester.ino
// https://gist.github.com/igrr/7f7e7973366fc01d6393
// https://github.com/iot-playground/Arduino/blob/master/ESP8266ArduinoIDE/DS18B20_temperature_sensor/DS18B20_temperature_sensor.ino
// esp8266 + dht22 + mqtt
#include "DHT.h"
#include <PubSubClient.h>
#include <ESP8266WiFi.h>
@BeauBouchard
BeauBouchard / Grandtheftauto5-linux.md
Last active August 20, 2024 13:33
How to install Grand Theft Auto V on Linux (Ubuntu x64 14.04) using wine.

How to install Grand Theft Auto V on Linux (Ubuntu x64 14.04) using wine.

Date Completed: Not done yet ~~ April 23rd 2015

My Test System

  • Video Card: Nvidia GTX 465 (lol right? Game runs shitty)
  • Driver: tested on 331.38, works on 331.38+
  • OS: Ubuntu x64 14.04
  • POL: I used Play on linux 4, I assume most of the capabilities are in winetricks
  • Wine: wine-staging Sun, 19 Apr 2015 version 1.7.41 x64 bit
@monkut
monkut / backends.py
Last active March 12, 2018 13:30
django (1.8) python3 LDAP (via ldap3) Authentication backend
"""
django (1.8) python3 LDAP (via ldap3) Authentication backend
Assumes 'AUTH_INFORMATION' is defined in settings.py in the form:
AUTH_INFORMATION = { 'LDAP'{
'USERNAME_SEARCH_FILTER': <ldap search filter, for example, '(uid={})'>,
'HOST': <ldap server host>,
'PORT': <ldap server port (integer)>,
'BASE_DN': <ldap base DN>,
@cansadadeserfeliz
cansadadeserfeliz / tests.py
Last active September 8, 2024 23:22
Mock/replace timezone.now() with a custom date in Django unittes
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import datetime
from mock import patch
from django.test import TestCase
from django.utils import timezone
class DatesTestCase(TestCase):

Folder Structure

Please note

While this gist has been shared and followed for years, I regret not giving more background. It was originally a gist for the engineering org I was in, not a "general suggestion" for any React app.

Typically I avoid folders altogether. Heck, I even avoid new files. If I can build an app with one 2000 line file I will. New files and folders are a pain.

@clemtibs
clemtibs / Commit Formatting.md
Last active February 13, 2025 03:36
Angular Commit Format Reference Sheet

Commit Message Format

This specification is inspired by and supersedes the [AngularJS commit message format][commit-message-format].

We have very precise rules over how our Git commit messages must be formatted. This format leads to easier to read commit history.

Each commit message consists of a header, a body, and a footer.

@NotSqrt
NotSqrt / settings_test_snippet.py
Last active May 1, 2022 01:34 — forked from nealtodd/settings_test_snippet.py
Another shot at this problem ..
class DisableMigrations(object):
def __contains__(self, item):
return True
def __getitem__(self, item):
return "notmigrations"
MIGRATION_MODULES = DisableMigrations()
@zxy1256
zxy1256 / Tmux.md
Last active January 6, 2024 04:18
Tmux

tmux shortcuts & cheatsheet

Sessions

start new:

tmux
@rponte
rponte / Club.java
Created June 25, 2014 19:26
Example of Hibernate Filters
package org.hibernate.test.annotations.filter.subclass.joined;
import java.util.HashSet;
import java.util.Set;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.OneToMany;