Skip to content

Instantly share code, notes, and snippets.


Fernando Jorge Mota fjorgemota

View GitHub Profile
fjorgemota /
Created Mar 25, 2020
Small script to convert to x264, which is accepted by telegram, whatsapp and a lot of other services


prepare-video source.mp4 output.mp4

The final video will use the x264 codec for video and aac codec for audio.

You'll need to install ffmpeg to be able to run that command.

fjorgemota / removedor-acentos.cpp
Created Nov 27, 2014
Removedor simples de acento em C
View removedor-acentos.cpp
#include <stdio.h>
#include <stdlib.h>
char* removeAcento(char *string){
int i=0;
int resultado = 0;
while(string[i] != '\0'){
if(!((string[i] < 97 || string[i] > 122) && (string[i] < 65 || string[i] > 90))) {
fjorgemota / hello.cpp
Last active Aug 29, 2015
Mini-Servidor em C++
View hello.cpp
#include <cstdlib>
#include <iostream>
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
using namespace std;
int main(int argc, char **argv) {
View gist:5223013
fjorgemota /
Last active Dec 11, 2015
Simple example of a pratical method to create private attributes in Python using functions closures
class People:
'''Just a class to save the name of a people'''
def __init__(self, name):
'''Just saves the name of a people'''
obj = {} #A internal variable to save the state of the attribute
def setName(new_name):
'''Just a function to set the name of a people'''
obj["name"] = new_name #It's available in the internal variable representation
self.setName = setName #Just point it to the object
def getName():
fjorgemota / convertHTMLtoJS.php
Created Sep 16, 2012
Convert HTML to Javascript using DOM in PHP
View convertHTMLtoJS.php
function convertHTMLtoJS($html){
$type = "string";
$type = get_class($html);
case "DOMDocument":
View functions.php
* Verifica o papel do usuário.
* Exempo de uso:
* if (is_current_user('administrator')) {
* echo 'Olá administrador';
* }
* @param string $user
fjorgemota /
Created Jul 7, 2012
Sift3 in Python
def sift3(s1,s2, maxOffset):
s1L = len(s1)
s2L = len(s2)
if not s1:
return (not s2 and 0 or s2L)
if not s2:
return s1L
c1 = 0
c2 = 0
lcs = 0
fjorgemota / table.html
Created May 17, 2012
Exemplo de Tabela HTML (apenas para fins educativos aqui no curso :P)
View table.html
<table border="0" width="100%">
<!-- Primeira linnha indica o nome das colunas -->
<td>Coluna 1</td>
<td>Coluna 2</td>
<td>Coluna 3</td>
<!-- Proximas linhas somente conteudo -->
fjorgemota / gist:1975415
Created Mar 4, 2012
Cutucada automática
View gist:1975415
1) Para cutucar automaticamente quem lhe cutuca, acesse a página pelo Google Chrome e tecle CTRL+SHIFT+I
2) Será aberto um terminal para você digitar o que quiser. Clique em "Console" e cole o seguinte código: setInterval(function(){var els = document.querySelectorAll("a.uiIconText[ajaxify*='\\/ajax\\/pokes']");for(var c=0;c<els.length;c++){var el = els[c];var e = document.createEvent("MouseEvent");e.initMouseEvent("click",true,true);el.dispatchEvent(e)}},1000)
3) Dê ENTER e deixe a aba aberta..Pronto! Agora quem lhe cutucar será re-cutucado em 1 segundo. :)
4) Agradeça ao, ou não, depois desses importantíssimos procedimentos de utilidade PÚBLICA.