Skip to content

Instantly share code, notes, and snippets.

View fegemo's full-sized avatar

Flávio Coutinho fegemo

View GitHub Profile
@fegemo
fegemo / hw-glx.c
Created March 6, 2019 22:04
Um Hello World em OpenGL usando C e a biblioteca glx.h.
#include <stdio.h>
#include <stdlib.h>
#include <X11/X.h>
#include <X11/Xlib.h>
#include <GL/gl.h>
#include <GL/glx.h>
void desenhaMinhaCena()
{
glClearColor(1, 1, 1, 1);
@fegemo
fegemo / find_dirty_gits
Created December 28, 2017 18:50 — forked from jaz303/find_dirty_gits
find all dirty git repos under the current working directory
#!/bin/bash
for dir in $(find . -name '.git' -type d)
do
dir=$(dirname $dir)
cd $dir
STATE=""
if [[ -n $(git ls-files --other --exclude-standard 2> /dev/null) ]]; then
@fegemo
fegemo / screenshot-avatar.js
Created November 22, 2017 02:24
Usando html2canvas para gerar uma imagem "pixelada" (nítida), e não desfocada
let baixarEl = document.querySelector('#baixar');
let avatarEl = document.querySelector('#avatar-preview');
baixarEl.addEventListener('click', function(e) {
html2canvas(avatarEl, {
onrendered: function(canvas) {
let contextoGrafico = canvas.getContext('2d');
contextoGrafico.webkitImageSmoothingEnabled = false;
contextoGrafico.mozImageSmoothingEnabled = false;
contextoGrafico.imageSmoothingEnabled = false;
@fegemo
fegemo / aliases.sh
Created February 21, 2017 23:26
Personal git setup
git config --global alias.co checkout
git config --global alias.cob "checkout -b"
git config --global alias.st status
git config --global alias.coolio "checkout -- *"
git config --global --add alias.lol "log --graph --decorate --pretty=oneline --abbrev-commit --all"
@fegemo
fegemo / pessoas.php
Created February 9, 2017 12:47
Lista pessoas em PHP e MySQL
<?php
/* Attempt MySQL server connection. Assuming you are running MySQL
server with default setting (user 'root' with no password) */
$link = mysqli_connect("localhost", "root", "", "demo");
// Check connection
if($link === false){
die("ERROR: Could not connect. " . mysqli_connect_error());
}
@fegemo
fegemo / hw-windows.c
Last active March 6, 2019 21:47
Um Hello World em OpenGL usando C e a biblioteca windows.h.
#include <windows.h>
#include <GL/gl.h>
char *className = "OpenGL";
char *windowName = "Hello World";
int winX = 0, winY = 0;
int winWidth = 500, winHeight = 500;
HDC hDC;
HGLRC hGLRC;
@fegemo
fegemo / hw-glut.c
Last active July 30, 2023 22:06
Um Hello World em OpenGL usando C e GLUT.
#include <GL/freeglut.h>
void desenhaMinhaCena(void)
{
glClearColor(1, 1, 1, 1);
glClear(GL_COLOR_BUFFER_BIT);
glBegin(GL_TRIANGLE_FAN);
glVertex3f(-0.5, -0.5, 0.0);
glVertex3f( 0.5, -0.5, 0.0);
glVertex3f( 0.5, 0.5, 0.0);