Skip to content

Instantly share code, notes, and snippets.

@drorata
drorata / gist:b05bfd59c45eec0470f6
Last active May 9, 2022 14:12
Nice output of pandas.DataFrame in org-mode
import pandas as pd
import numpy as np
from tabulate import tabulate

df = pd.DataFrame(np.random.random((4,3)), columns=['A','B','C'])
print("foo")
return(tabulate(df, headers="keys", tablefmt="orgtbl"))
@tsbarnes
tsbarnes / monokai-dark.theme
Created August 12, 2015 04:53
Monokai color scheme for XFCE4 terminal, place it in /usr/share/xfce4/terminal/colorschemes
[Scheme]
Name=Monokai (dark)
TabActivityColor=#a6a6e2e22e2e
ColorCursor=#f8f8f8f8f2f2
ColorForeground=#f8f8f8f8f2f2
ColorBackground=#272728282222
ColorPalette=#272728282222;#f9f926267272;#a6a6e2e22e2e;#f4f4bfbf7575;#6666d9d9efef;#aeae8181ffff;#a1a1efefe4e4;#f8f8f8f8f2f2;#757571715e5e;#f9f926267272;#a6a6e2e22e2e;#f4f4bfbf7575;#6666d9d9efef;#aeae8181ffff;#a1a1efefe4e4;#f9f9f8f8f5f5

General TTD Advice

  • If you can't test the code efficiently, refactor the code.
  • Don't hardcode URLs in views, templates and tests. (Use revert instead?)
  • Use named views and reverse URL resolution, instead.
  • Never refactor against failing UNIT tests.
  • Don't forget the REFACTOR on 'Red, Green, Refactor'.
  • Tests makes possible using the application state as a save-points for refactors. Once you get to them again, you'll know your refactoring is done.
  • Every single FT doesn't need to test every single part of your application, but use caution when de-duplicating your FTs. (FTs exist to catch unpredictable interactions between different parts of your application, after all)
  • Use loggers named after the module you're in. Follow the logging.getLogger(__filename__) pattern to get a logger that's unique to your module, but that inherits from a top-level configuration you control.
@maxclaus
maxclaus / alias-docker-compose.sh
Last active August 27, 2023 15:11
Aliases for docker-compose
alias c='docker-compose'
alias cb='docker-compose build'
alias cup='docker-compose up'
alias cr='docker-compose run --service-ports --rm'
alias crl='docker-compose run --service-ports --rm local'
alias crd='docker-compose run --service-ports --rm develop'
alias crt='docker-compose run --rm test'
alias crp='docker-compose run --rm provision'
alias crci='docker-compose run --rm ci'
alias crwt='docker-compose run --rm watchtest'
! `xev` and `showkey` to see which keycode is pressed
!old keys
!xmodmap -pke |grep Something
!keycode 50 = Shift_L ISO_Prev_Group Shift_L ISO_Prev_Group
!keycode 62 = Shift_R ISO_Next_Group Shift_R ISO_Next_Group
!keycode 66 = Caps_Lock NoSymbol Caps_Lock
!keycode 22 = BackSpace BackSpace BackSpace BackSpace NoSymbol NoSymbol Terminate_Server
!keycode 37 = Control_L NoSymbol Control_L
@igr-santos
igr-santos / catarse.rst
Last active May 6, 2016 16:59
Documento tem como objetivo montar a campanha para crowdfunding

Campanha Python Sudeste 2016

Esse documento tem como objetivo montar a campanha para organizarmos as finanças e recompensas do evento Python Sudeste 2016, no modelo de crowdfunding, utilizando a ferramenta do Catarse

TODO

extern crate rocket;
use rocket::{Request, Data, Outcome};
use rocket::data::{self, FromData};
use rocket::Outcome::*;
use std::collections::HashMap;
pub struct WhereStructResult {
sql: String, values: Vec<String>,
#[allow(unused_imports)]
#[macro_use]
extern crate lazy_static;
#[cfg(test)]
mod tests {
use std::sync::{Mutex, MutexGuard, Once, ONCE_INIT};
/// Substitua String pelo tipo da sua conexão.
lazy_static! {
anonymous
anonymous / playground.rs
Created January 21, 2018 16:54
Rust code shared from the playground
trait AsRecord {
fn as_record(&self) -> String;
}
#[derive(Debug)]
struct MyRecord(u32);
impl AsRecord for MyRecord {
fn as_record(&self) -> String {
format!("hey, I've got {}", self.0)
}