Skip to content

Instantly share code, notes, and snippets.


Anderson Fraga andersonfraga

Block or report user

Report or block andersonfraga

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
class A<T> {
private T var;
public A(T elm) {
var = elm;
public void damm() {
// this.var para simplificar
fun((T) method.invoke(this.var);
View gist:74f57527d7397a1ec2a35aace79543b7
; vim /etc/apt/sources.list
deb jessie main non-free contrib
deb-src jessie main non-free contrib
; terminal
sudo apt update
sudo apt install gcc-4.8 g++-4.8
; vim /etc/apt/sources.list
#deb jessie main non-free contrib
andersonfraga /
Last active Mar 2, 2018
Xfce 4.12 it's dumb and stupid. So I need to manually inform the order of monitors and their panel's location
# source
# Check if our external monitor name is in the list connected displays
grep_output=`xrandr | grep "HDMI-1 connected"`
if [ "$grep_output" != "" ]; then
# The external monitor IS connected. Put it right of there internal and move xfce-panel there
View client.c
#include <string.h>
#include "headers.h"
int main(int argc, char const *argv[])
int id_shared, id_server;
char *psh_msg;
sem_t *sem_server;
View philosopher.c
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
typedef struct philosopher_sct {
int think;
int waited;
andersonfraga /
Created May 27, 2016
Execute notify-send via cronjob
# * * * * * /bin/sh "Teste 1 2 3"
PID=$(/usr/bin/pgrep gnome-session)
dbus=$(/bin/grep -z DBUS_SESSION_BUS_ADDRESS /proc/$PID/environ|cut -d= -f2-)
DISPLAY=:0.0 /usr/bin/notify-send --urgency=critical "Alert using crontab" "$1"
} >> $HOME/crontab/alert.log 2>&1
andersonfraga / divisible.go
Created May 17, 2016
Brincando com go... But, tem será maneira mais 'go-style' de fazer isso?
View divisible.go
package main
import "os"
import "fmt"
import "math"
import "strconv"
func main() {
number, _ := strconv.ParseFloat(os.Args[1:2][0], 64)
denom := float64(2)
View Lexica_01.flex
* Anderson Jean Fraga
* 13180375
* Compiladores - Trabalho 1 - Exercicio 1
%class Lexica_01
andersonfraga / index.php
Last active Aug 29, 2015
Busca a menor máscara possível em uma lista de CIDRs
View index.php
class IPv4Subnet
private $address, $mask;
function __construct($ip)
list($this->address, $this->mask) = $this->toBin($ip);
andersonfraga / ques.sml
Created Oct 9, 2014
E em 30mins brincando com esse tal de AliceML...
View ques.sml
Especifique a função mediaListaSemPares que recebe uma lista de inteiros umaLista e retorna a média dos elementos de umaLista, descartando os valores pares (listas com 1 ou nenhum elemento, retornam vazias)
fun listaSemPares umaLista = List.filter (fn x => x mod 2 <> 0) umaLista;
fun somaLista [] = 0
| somaLista (x::res) = x + somaLista res;
fun mediaListaSemPares [] = 0.0
| mediaListaSemPares umaLista =
You can’t perform that action at this time.