Skip to content

Instantly share code, notes, and snippets.

View scrollbar.java
//show AST in GUI
JFrame frame = new JFrame("Antlr AST");
JPanel panel = new JPanel();
JScrollPane scrollPane = new JScrollPane(panel);
scrollPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
scrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_NEVER);
scrollPane.setBounds(50, 30, 300, 50);
TreeViewer viewr = new TreeViewer(Arrays.asList(
parser.getRuleNames()),tree);
viewr.setScale(1.5);//scale a little
View template.tmpl
<html>
<head><title>Hello</title></head>
<body>Hello World<br>
Current Time is <TMPL_VAR NAME="current_time">
</body>
</html>
View perl.cgi
#!/usr/bin/perl -wT
use strict;
use HTML::Template;
use constant TMPL_FILE => "$ENV{DOCUMENT_ROOT}/template.tmpl";
my $tmpl = new HTML::Template(filename => TMPL_FILE);
my $time = localtime;
$tmpl->param(current_time => $time);
print "Content-type: text/html\n\n",
@eduardosan
eduardosan / python.py
Created Aug 18, 2016
Python basic cgi
View python.py
#!/usr/bin/env python
# -*- coding: UTF-8 -*-# enable debugging
import cgitb
cgitb.enable()
print("Content-Type: text/html;charset=utf-8")
print("")
print("Hello World!")
View erro-pagarme
PagarMe_Transaction Object
(
[_attributes:protected] => Array
(
[payment_method] => boleto
[card_hash] =>
[amount] => 8000
[postback_url] => http://ecodobem.com.br/act/retorno.pagarme.php
[soft_descriptor] =>
[installments] => 1
@eduardosan
eduardosan / twitter-extract
Last active Aug 29, 2015
Extrai dados do Twitter
View twitter-extract
#!/usr/env python
# -*- coding: utf-8 -*-
import twitter
import pprint
api = twitter.Api(consumer_key='consumer_key',
consumer_secret='consumer_secret',
access_token_key='access_token',
access_token_secret='access_token_secret')
@eduardosan
eduardosan / installcacic.bat
Last active Feb 20, 2019
Script .BAT para instalação do Cacic
View installcacic.bat
cls
@echo off
set __COMPAT_LAYER=RunAsInvoker
REM COMANDO ABAIXO USADO PARA EXECUTAR O INSTALLCACIC SEM QUESTIONAMENTOS.
REM ###########################################################################
REM # INSERIR DADOS NECESSÁRIOS PARA A INSTALAÇÃO #
REM ## Usuário do ftp está como padrão. ##
@eduardosan
eduardosan / atualizacao-20181210.sql
Last active Aug 29, 2015
Atualização Softwares Licenciados
View atualizacao-20181210.sql
CREATE TABLE aquisicoes_software (id_software INT NOT NULL, id_aquisicao INT NOT NULL, id_tipo_licenca INT NOT NULL, PRIMARY KEY(id_software, id_aqui
sicao, id_tipo_licenca));
CREATE INDEX IDX_6BCDE8B1270B845A ON aquisicoes_software (id_software);
CREATE INDEX IDX_6BCDE8B1CF537CBE2AFF7683 ON aquisicoes_software (id_aquisicao, id_tipo_licenca);
ALTER TABLE aquisicoes_software ADD CONSTRAINT FK_6BCDE8B1270B845A FOREIGN KEY (id_software) REFERENCES software (id_software) NOT DEFERRABLE INITIALLY IMMEDIATE;
ALTER TABLE software_estacao DROP CONSTRAINT fk_9bbdd0f8270b845a;
ALTER TABLE software_estacao DROP CONSTRAINT fk_9bbdd0f8cf537cbe;
alter table software_estacao DROP CONSTRAINT software_estacao_pkey;