Skip to content

Instantly share code, notes, and snippets.

View atilacamurca's full-sized avatar

Átila Camurça Alves atilacamurca

View GitHub Profile
@atilacamurca
atilacamurca / _service.md
Created April 17, 2017 17:41 — forked from naholyr/_service.md
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
$(document).ready(function() {
// add a hash to the URL when the user clicks on a tab
$('a[data-toggle="tab"]').on('click', function(e) {
history.pushState(null, null, $(this).attr('href'));
});
// navigate to a tab when the history changes
window.addEventListener("popstate", function(e) {
var activeTab = $('[href="' + location.hash + '"]');
if (activeTab.length) {
activeTab.tab('show');
@atilacamurca
atilacamurca / SlideShare.php
Created December 1, 2014 13:46
zf1 - workaround for slideshare api 2.0 support in zf1 - just replace the method _slideShowNodeToObject
<?php
class Zend_Service_SlideShare
{
/**
* Converts a SimpleXMLElement object representing a response from the service
* into a Zend_Service_SlideShare_SlideShow object
*
* @param SimpleXMLElement $node The input XML from the slideshare.net service
* @return Zend_Service_SlideShare_SlideShow The resulting object
@atilacamurca
atilacamurca / haertblaad.py
Created July 9, 2014 01:30
desafio 4 - script para gerar arquivo com letras trocadas.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
if __name__ == '__main__':
file = open("heartbleed.txt")
lines = ""
for line in file:
aux = list(line)
for i in range(len(aux)):
if aux[i] == "a":
@atilacamurca
atilacamurca / dica-02.hex
Last active August 29, 2015 14:03
desafio-hacker-comsolid7
data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAoAAAAHgCAYAAAA10dzkAAAABmJLR0QA/wD/AP+gvaeTAAAACXBIWXMAAAsTAAALEwEAmpwYAAAAB3RJTUUH3gYdABEHBG4brgAAABl0RVh0Q29tbWVudABDcmVhdGVkIHdpdGggR0lNUFeBDhcAAAlWSURBVHja7d0hS2txHMfhs+uCIL4Ai2AwGCwKKgwUbAPbgiIIwhA0iAbLQNPAZrGIWOaKZSBYDILLFhEGgt20gZpWva/gXn7jnqPX7XnyFzn+9cCHfzm5JEk+EwAABsYvRwAAIAABABCAAAAIQAAABCAAAAIQAAABCACAAAQAQAACACAAAQAQgAAACEAAAAQgAAACEABAAAIAIAABABCAAAAIQAAABCAAAAIQAAABCACAAAQAQAACACAAAQAQgAAACEAAAAQgAAACEABAAAIAIAABABCAAAAIQAAABCAAAAIQAAABCACAAAQAQAACACAAAQAQgAAACEAAAAQgAIAABABAAAIAIAABABCAAAAIQAAABCAAAAIQAAABCACAAAQAQAACACAAAQAQgAAACEAAAAQgAIAABABAAAIAIAABABCAAAAIQAAABCAAAAIQAAABCACAAAQAQAACACAAAQAQgAAACEAAAAEIAIAABABAAAIAIAABABCAAAAIQAAABCAAAAIQAAABCACAAAQAQAACACAAAQAQgAAACEAAAAEIAIAABABAAAIAIAABABCAAAAIQAAABCAAAAIQAAABCACAAAQAQAACABCTdwQAfzcxMRHeFgqF8Pbx8TG8fX5+zuR3W1hYCG/n5ubC21arFd42m80f9f9QKpXC21wuF942Gg0vG1/GDSAAgAAEAEAAAgAgAAEAEIAAAAhAAAAEIAAAAhAAAAEIAIAABAAgDbkkST4dAzBohoaGwtuHh4fwdnZ2Nrw9ODgIb09OTsLb1dXV8Pby8jK8rdVq4e36+np4e3h4GN6enp5m8v+wsb
@atilacamurca
atilacamurca / gerar-certificados-flisol.md
Created May 1, 2014 13:45
Gerar certificados do FLISOL

Baixe o projeto: https://www.dropbox.com/s/ep3t7h12ypkottg/flisol-cert.tar.bz2

  1. extrair
  2. instalar php5 e php5-gd (apt-get install php5 php5-gd)
  3. abre um terminal
  4. entra no diretorio do projeto
  5. você encontrará um arquivo chamado ParticipantesFlisol.ods, esse arquivo deverá conter o nome dos participantes. Abra o arquivo exemplo e veja como ele deve ser montado.
  6. Mude também o modelo do certificado em img/modelo.jpg. Use o mesmo tamanho e formato para melhor qualidade do certificado.
  7. executa ./gerar.sh. Esse script irá converter os dados para CSV e fazer um certificado para cada nome encontrado.
  8. tomar um café, porque vai demorar um pouco, mas dá pra acompanhar o processo na tela :)
@atilacamurca
atilacamurca / SlideShare.php
Created April 3, 2014 19:41
Trecho referente a classe Zend_Service_SlideShare, houve mudanças na API e alguns nomes das tags do XML estão diferentes.
protected function _slideShowNodeToObject(SimpleXMLElement $node)
{
if($node->getName() == 'Slideshow') {
$ss = new Zend_Service_SlideShare_SlideShow();
$ss->setId((string)$node->ID);
$ss->setDescription((string)$node->Description);
$ss->setEmbedCode((string)$node->Embed); // changed
$ss->setNumViews((string)$node->Views);
@atilacamurca
atilacamurca / Api.java
Created March 10, 2014 17:20
Cross Site Access via JSONP
public abstract class Api extends HttpServlet {
protected void responder(JSONObject resultado, HttpServletResponse response, String callback) {
try {
response.setContentType("text/javascript;charset=utf-8");
response.setHeader("Access-Control-Allow-Headers", "Content-Type, x-xsrf-token");
PrintWriter out = response.getWriter();
String saida = callback + "(" + resultado + ");";
out.print(saida);
} catch (IOException e) {
@atilacamurca
atilacamurca / questoes.py
Created November 26, 2013 17:30
algoritmo para escolha de 5 questões aleatórias
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import random
questoes_disponiveis = [1, 2, 3, 4, 5, 6, 7, 8, 9]
questoes_escolhidas = []
i = 0
while i < 5:
rand = random.randrange(len(questoes_disponiveis))
@atilacamurca
atilacamurca / printme.py
Created April 18, 2013 23:33
print the file itself
import os
if __name__ == '__main__':
os.system("cat %s" % os.path.abspath(__file__))
exit(0)
print "hello world."