Skip to content

Instantly share code, notes, and snippets.

View JuniorPolegato's full-sized avatar

Junior Polegato JuniorPolegato

View GitHub Profile
@JuniorPolegato
JuniorPolegato / resimg
Created April 27, 2016 15:41
Resize images from a folder to another folder
#!/bin/bash
ORIG="`zenity --file-selection --directory \
--title "Pasta com as imagens originais"`"
echo "ORIG: $ORIG"
if [ -z "$ORIG" ]; then
exit 1
fi
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import re
import locale
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GObject
@JuniorPolegato
JuniorPolegato / recombinar_vetores.c
Last active March 30, 2016 19:12
Recombina vetores elemento por elemento
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[]){
int i;
// Vetor de subvetores de inteiros com tamanhos não definidos
int* A[] = {(int[]){4, 5}, (int[]){1}, (int[]){3, 6, 7}};
// Vetor com o tamanho de cada subvetor
int An[] = {2, 1, 3};
arvore = [
[0, False],
[1, True],
[1, False],
[2, False],
[2, True],
[2, False],
[3, False],
[3, True],
[2, False],
@JuniorPolegato
JuniorPolegato / Token.java
Created October 6, 2015 13:19
Programa simples em Java para acessar cartão token A3
import java.security.KeyStore;
import java.security.PrivateKey;
import java.security.Signature;
import java.security.SecureRandom;
import java.util.Enumeration;
import javax.xml.bind.DatatypeConverter;
class Token {
public static void main(String[] a) {
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Dados sequenciais
# dados = range(1, 1 << 5)
# Dados aleatórios duplicados
from random import randint
dados = [randint(0, 9) for x in xrange(1, 1 << 7)]
#include <Python.h>
/* Compilando:
* gcc -Wall -shared -fPIC -o intercalar.so intercalar.c -I /usr/include/python2.7
*
* Usando:
* import intercalar
* intercalar.intercalar('AABBCCDDEE', '1', 2)
*/
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
OPERADORES = (u'√^', '*/', '+-')
RE_OPS = '([\\' + '\\'.join(''.join(OPERADORES)) + '])'
def separar_operandos_e_operadores(expressao):
#!/usr/bin/env python
# -*- coding: utf-8 -*-
def perguntar(texto, tipo, igual_a=None, maior_que=None, menor_que=None):
texto += ' ' if texto[-1] in [':', '?'] else ': '
while True:
try:
digitado = tipo(raw_input(texto))
valido = (igual_a is None
# -*- coding: utf-8 -*-
from __future__ import print_function
ciclos = int(input("Digite o número de ciclos: "))
import time
t0 = time.time()
base = [1, 5, 11, 13, 17, 19, 23, 25, 29, 31, 37, 41]