Skip to content

Instantly share code, notes, and snippets.

View novasdream's full-sized avatar

Bruno Novais novasdream

  • Cardoso, SP - Brasil
View GitHub Profile
def caesar_cipher(message, key)
alphabet = [*"a".."z"]
alphabet_cifred = alphabet[key..26] + alphabet[0..key]
c_array = message.split('')
c_lambda = lambda {
|c|
upper = c == c.upcase
```java
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
httpClient.addInterceptor(logging); // <-- this is the important line!
retrofit = new Retrofit.Builder()
.baseUrl(getResources().getString(R.string.serverUrl))
.addConverterFactory(GsonConverterFactory.create(gson))
@novasdream
novasdream / Renomear sequencialmente
Created December 8, 2016 22:12
arquivo bat para renomear de forma sequencial. Enquanto não descubro como renomear o arquivo direto pela xtrax.
@echo off
set /p start=Insira o valor inicial de saida:
setlocal enableDelayedExpansion
for /r %%g in (*.JPG) do (call :RenameIt %%g)
goto :eof
goto :exit
:RenameIt
@novasdream
novasdream / matriz_esparsa_struct.c
Created June 1, 2016 22:42 — forked from marcoscastro/matriz_esparsa_struct.c
matriz esparsa - estrutura
/*
Estrutura célula contendo os seguintes campos:
- valor
- linha e coluna (posição da célula)
- ponteiro para o próximo elemento
- ponteiro para o elemento anterior
*/
typedef struct celula
{
int valor;
@novasdream
novasdream / matriz_esparsa.cpp
Created June 1, 2016 22:42 — forked from marcoscastro/matriz_esparsa.cpp
Programação em C - Matriz esparsa
/*
Implementação de matriz esparsa usando lista duplamente ligada
www.GeeksBR.com
*/
#include <stdio.h>
#include <stdlib.h>
#define MAX 10 // máximo do vetor de células (ver na função main)
Empresa.create({
'nome' : 'La Femi Níssima',
'end' : 'Av Rio Branco 2230',
'hra' : '8 as 22 horas',
'tel' : ['11 5423-2342','11 99837-2342']
},{
'nome' : 'Sushi House',
'end' : 'Av Paulista 1024',
'hra' : 'A partir das 18:30',
'tel' : ['11 5423-2342','11 99837-2342']
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
enum {
SUM = '+',
MULT = '*',
SUB = '-',
DIVISION = '/'
} ;
@novasdream
novasdream / clojure-match.clj
Last active August 29, 2015 14:26 — forked from ckirkendall/clojure-match.clj
Language Compare F#, Ocaml, Scala, Clojure, Ruby and Haskell - Simple AST example
(use '[clojure.core.match :only [match]])
(defn evaluate [env [sym x y]]
(match [sym]
['Number] x
['Add] (+ (evaluate env x) (evaluate env y))
['Multiply] (* (evaluate env x) (evaluate env y))
['Variable] (env x)))
(def environment {"a" 3, "b" 4, "c" 5})
@novasdream
novasdream / .vimrc
Last active August 29, 2015 14:16 — forked from gtcarlos/.vimrc
set nocompatible
filetype off
" Vundle
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'gmarik/Vundle.vim' " Required
Plugin 'tpope/vim-fugitive'
Plugin 'vim-scripts/closetag.vim'
/*
This code should be pasted within the files where this function is needed.
This function will not create any code conflicts.
The function call is similar to printf: ardprintf("Test %d %s", 25, "string");
To print the '%' character, use '%%'
This code was first posted on http://arduino.stackexchange.com/a/201
*/