Skip to content

Instantly share code, notes, and snippets.

View dimiro1's full-sized avatar

Claudemiro A F Neto dimiro1

  • Berlin, Germany
View GitHub Profile
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'nome-do-banco',
'USER': 'ususario-do-banco',
'PASSWORD': 'senha',
'HOST': 'localhost',
'PORT': '3306',
}
}
#!/usr/bin/python
import sys
import MySQLdb
import subprocess
my_host = "localhost"
my_user = "usuario"
my_pass = "senha"
my_db = "banco"
command_restart_mysql = "service mysql restart"
@dimiro1
dimiro1 / ANDROID.rst
Created March 12, 2014 17:47
ANDROID LINKS
#!/bin/bash
# Based on https://gist.github.com/2206527
# Be pretty
echo -e " "
echo -e " . ____ . ______________________________"
echo -e " |/ \| | |"
echo -e "[| \e[1;31m♥ ♥\e[00m |] | S3 MySQL Backup Script v.0.1 |"
echo -e " |___==___| / © oodavid 2012 |"
import javafx.scene.layout.StackPane;
import javafx.scene.web.WebView;
/**
* A syntax highlighting code editor for JavaFX created by wrapping a
* CodeMirror code editor in a WebView.
*
* See http://codemirror.net for more information on using the codemirror editor.
*/
public class CodeEditor extends StackPane {
@dimiro1
dimiro1 / cpf.go
Last active August 29, 2015 14:11
Validador de CPF
package cpf
import (
"errors"
"strconv"
"strings"
)
var CpfInvalido = errors.New("Cpf Inválido")
@dimiro1
dimiro1 / dc.c
Created December 24, 2014 12:53
Pequena implementação da calculadora "dc" do GNU/Linux
/***************************************************************************
* Pequena implementação da calculadora "dc" do GNU/Linux *
* Não é uma implementação para calculos de alta precisão *
* Copyright (C) 2009 by Claudemiro Alves Feitosa Neto *
* dimiro1@gmail.com *
* Modified: <2009-05-21 20:58:52 BRT> *
* *
* This program is free software: you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation, either version 3 of the License, or *

pyvenv-3.3 (Ubuntu 13.10, also Debian)

Symptoms

pyvenv-3.3 venvdir
venvdir/bin/python -c 'import sys; print(sys.path)'
# This should print the venvdir in sys.path.

But in buggy Ubuntu/Debian, it doesn't.

@dimiro1
dimiro1 / main.py
Created May 25, 2015 23:56
Permutations Python
from itertools import permutations
sum(1 for i in [int(''.join(str(x) for x in e)) for e in permutations([2,3,5,6,7,9], 3)] if i % 5 == 0)