Skip to content

Instantly share code, notes, and snippets.

Avatar
🧩
Focusing

Anderson Fraga andersonfraga

🧩
Focusing
View GitHub Profile
View Default.sublime-keymap
[
{ "keys": ["ctrl+shift+l"], "command": "copy_basename_file" },
{ "keys": ["ctrl+shift+g"], "command": "copy_basename_file_github" }
]
@andersonfraga
andersonfraga / disable.sh
Created May 8, 2020 — forked from pwnsdx/disable.sh
Disable bunch of #$!@ in Catalina
View disable.sh
#!/bin/bash
# IMPORTANT: Don't forget to logout from your Apple ID in the settings before running it!
# IMPORTANT: You will need to run this script from Recovery. In fact, macOS Catalina brings read-only filesystem which prevent this script from working from the main OS.
# This script needs to be run from the volume you wish to use.
# E.g. run it like this: cd /Volumes/Macintosh\ HD && sh /Volumes/Macintosh\ HD/Users/sabri/Desktop/disable.sh
# WARNING: It might disable things that you may not like. Please double check the services in the TODISABLE vars.
# Get active services: launchctl list | grep -v "\-\t0"
# Find a service: grep -lR [service] /System/Library/Launch* /Library/Launch* ~/Library/LaunchAgents
View generics.java
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 http://http.debian.net/debian/ jessie main non-free contrib
deb-src http://http.debian.net/debian/ jessie main non-free contrib
; terminal
sudo apt update
sudo apt install gcc-4.8 g++-4.8
; vim /etc/apt/sources.list
#deb http://http.debian.net/debian/ jessie main non-free contrib
@andersonfraga
andersonfraga / start-displays.sh
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
View start-displays.sh
#!/bin/bash
# source https://forum.xfce.org/viewtopic.php?pid=46361#p46361
#
# 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>
#define NANO_SECOND_MULTIPLIER 1000000
typedef struct philosopher_sct {
int think;
int waited;
@andersonfraga
andersonfraga / cronjob.sh
Created May 27, 2016
Execute notify-send via cronjob
View cronjob.sh
#!/bin/bash
# * * * * * /bin/sh cronjob.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-)
export DBUS_SESSION_BUS_ADDRESS=$dbus
DISPLAY=:0.0 /usr/bin/notify-send --urgency=critical "Alert using crontab" "$1"
} >> $HOME/crontab/alert.log 2>&1
@andersonfraga
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
*/
%public
%class Lexica_01