Skip to content

Instantly share code, notes, and snippets.

View gustavosbarreto's full-sized avatar
🧉
Drinking mate

Luis Gustavo S. Barreto gustavosbarreto

🧉
Drinking mate
View GitHub Profile
import QtQuick 2.1
Rectangle {
color: "red"
Rectangle {
color: "blue"
width: parent.width/2
height: parent.height/2
#!/usr/bin/sudo sh
## ruby_revealer.sh -- decrypt obfuscated GHE .rb files. 2.0.0 to 2.3.1+.
## From `strings ruby_concealer.so`:
##
## > This obfuscation is intended to discourage GitHub Enterprise customers
## > from making modifications to the VM.
##
## Well, good, as long as its not intended to discourage *me* from doing this!
sudo unsquashfs binary/live/filesystem.squashfs | stdbuf -oL tr '\r' '\n' | while read line; do echo $line | sed 's,.*\s,,g' | grep '%'; done
var express = require('express');
var app = express();
var http = require('http');
var WebSocketServer = require('ws').Server;
var server = http.createServer(app);
server.listen(3000);
var wss = new WebSocketServer({server: server});
@gustavosbarreto
gustavosbarreto / README.md
Last active August 29, 2015 14:04
Job scheduling with Shellscript

Job scheduling with Shellscript

@gustavosbarreto
gustavosbarreto / gladimiralg.java
Last active August 29, 2015 14:02
Gladimir Robocode Alg
package gustavo;
import java.awt.geom.Point2D;
import robocode.AdvancedRobot;
import robocode.ScannedRobotEvent;
import robocode.util.Utils;
public class Gladmir extends AdvancedRobot {
class CenterPoint {
public double distance;
#!/bin/sh
WHITELIST="/devices/pci0000:00/0000:00:1c.3/0000:04:00.0/usb3/3-2
/devices/pci0000:00/0000:00:1c.3/0000:04:00.0/usb3/3-1"
USB_DEVICE=$(udevadm info --attribute-walk -p /sys/class/net/$INTERFACE | grep "looking at parent device" | head -2 | tail -1 | sed -nr "s/.*'(.+)'.*/\1/p")
if ! echo $WHITELIST | grep -q $USB_DEVICE; then
echo 0 >> /sys/$USB_DEVICE/authorized
fi
#include <iostream>
#include <string>
#include <vector>
#include <algorithm>
#include <sstream>
using namespace std;
// retorna posicao do ultimo char consecutivo apartir de 'pos'
int last_consecutive_pos(vector<int> v, int pos) {
@gustavosbarreto
gustavosbarreto / oslog_with_qt.cpp
Created October 14, 2011 19:02
Qt + oslog library
void oslogMessageOutput(QtMsgType type, const char *msg)
{
switch (type) {
case QtDebugMsg:
oslog_info("%s", msg);
break;
case QtWarningMsg:
oslog_warning("%s", msg);
break;
case QtCriticalMsg:
@gustavosbarreto
gustavosbarreto / clearenv.sh
Created August 30, 2011 14:05
Clear all environment variables
unset `env | awk -F= '/^\w/ {print $1}' | xargs`