Skip to content

Instantly share code, notes, and snippets.

View joepreludian's full-sized avatar
🛰️
Working from home

Jonhnatha Trigueiro joepreludian

🛰️
Working from home
View GitHub Profile
@joepreludian
joepreludian / glsdosul.java
Created April 7, 2013 03:20
Arquivo Java com anotações do hangout
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package bandeira;
import java.awt.Color;
import java.awt.Graphics;
import java.awt.GraphicsConfiguration;
import java.awt.Point;
@joepreludian
joepreludian / texto_graphics.java
Created April 7, 2013 03:39
CodeSnippet - Java - Texto no objeto Graphics
//Pra colocar um texto
g.setColor(Color.GREEN);
//Determina a fonte e seu tamanho
Font font = new Font("Callibri", Font.PLAIN, 30);
g.setFont(font);
//Desenha o texto
g.drawString("Pedro maluco!", 25, 100);
@joepreludian
joepreludian / checksite.sh
Created September 30, 2013 13:29
Que tal conferir se um site mudou de status? Fui realizar uma inscrição pra minha noiva e o site estava com uma mensagem de erro. Criei um shellscript que checava no site se ele tinha voltado a funcionar. Usei o cURL e o md5 pra fazer uma assinatura da mensagem. No exemplo ele preenche um formulário, enviando para o site do cadastro, identifican…
#!/bin/bash
say -r 190 "Up and running. Listening website for changes. I will keep You in touch. Bye.";
while [ 1 ]
do
get_status=$(curl -X POST "http://www.pm.pb.gov.br/concursos/inscricao__cfo/index.php" -d "dt_nascimento=01/01/1987" -d "nm_cpf=xxx.xxx.xxx-xx" -A "Mozilla/5.0 (Windows NT 6.2; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/30.0.1599.17 Safari/537.36" -d "modo=1" -d "cd_aluno=" -s | md5);
if [ $get_status = "e5948a465a078db264bb770ccea87510" ]
then
echo "Nothing new. Trying in 5 minutes...";
@joepreludian
joepreludian / mencoder-legenda
Created October 25, 2013 18:25
Embutindo legenda em um filme via linha de comando
#!/bin/sh
mencoder -sub $1.srt -ovc xvid -xvidencopts bitrate=-7000000 -oac copy -o $2.avi $1.avi -subwidth 90 -subpos 95 -subfont-text-scale 3
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js" type="text/javascript"></script>
<script src="skulpt.min.js" type="text/javascript"></script>
<script src="skulpt-stdlib.js" type="text/javascript"></script>
</head>
<body>
@joepreludian
joepreludian / negativo.py
Created November 15, 2013 15:05
Numero Negativo - Eliselma - Python
vetor = []
qtd_negativo = 0
for i in range(5):
print 'Insira o %s numero' % i
vetor.append(int(raw_input()))
for item in vetor:
if item < 0:
qtd_negativo += 1
USERS = {'admin@admin': '123',
'user': '123'}
GROUPS = {'admin': ['group:sysadmin'],
'user': ['group:users']}
def groupfinder(userid, request):
if userid in USERS:
return GROUPS.get(userid, [])
@joepreludian
joepreludian / terminal_scroller.js
Created December 9, 2013 18:11
Script para atuar como um scroller estilo terminal do linux. basta jogar o seguinte código. Chega na div que quer que scroll funcione e adicione 'terminal' na propriedade 'class'; crie um checkbox e coloque nele a tag 'data-scroller' com o valor igual ao id da div que você elegeu para ser o scroller. Este checkbox habilitará/desabilitará o modo …
$("div[class~=terminal]").on('DOMNodeInserted', function(){
var current_scroll = this.scrollHeight;
var element_height = $(this).height();
var this_element_id = $(this).attr('id');
var is_allowed_to_scroll = $('input[data-scroller='+ this_element_id +']:checked',0).length;
if (is_allowed_to_scroll)
if (current_scroll > element_height)
this.scrollTop = current_scroll
@joepreludian
joepreludian / negativo.cpp
Created December 11, 2013 12:55
Primeira questão de Eliselma - Trabalho.
//
// 1) Negativo
//
// Lê 5 valores inteiros, um de cada vez, conta quantos destes valores são negativos e imprime esta informação.
//
#include <iostream>
using namespace std;
int main(int argc, const char * argv[])
@joepreludian
joepreludian / intervalo.cpp
Created December 11, 2013 13:32
Segundo exercício da lista de exercícios da professora Eliselma.
//
// 1) Intervalos
//
// Lê um número não conhecido de valores, um de cada vez, e conta quantos deles estão em cada um dos intervalos
// [0; 25), [25; 50), [50; 75) e [75; 100]
//
#include <iostream>
using namespace std;