Skip to content

Instantly share code, notes, and snippets.

View polaco1782's full-sized avatar

Cassiano Martin polaco1782

  • Santa Cruz do Sul, RS, Brazil
View GitHub Profile
@polaco1782
polaco1782 / pybrowser.py
Created February 27, 2018 12:38 — forked from kklimonda/pybrowser.py
A minimal Gtk+/Webkit based browser in Python
import sys
from gi.repository import Gtk, Gdk, WebKit
class BrowserTab(Gtk.VBox):
def __init__(self, *args, **kwargs):
super(BrowserTab, self).__init__(*args, **kwargs)
go_button = Gtk.Button("go to...")
go_button.connect("clicked", self._load_url)
self.url_bar = Gtk.Entry()
@polaco1782
polaco1782 / debian-rclocal.sh
Created March 3, 2018 19:12
Enable rc.local systemd compatibility on Debian 9
cat <<EOF >/etc/rc.local
#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# EditorConfig helps developers define and maintain consistent
# coding styles between different editors and IDEs
# editorconfig.org
root = true
[*]
end_of_line = lf
charset = utf-8
@polaco1782
polaco1782 / slowgram.sh
Created June 22, 2019 03:19
Slow down instagram and facebook on you network. Applies to Brazilian NET/Claro networks
#!/bin/sh
tc qdisc del dev eth1 root
echo 0 > /proc/fast_nat
tc qdisc add dev eth1 root handle 1: prio
tc qdisc add dev eth1 parent 1:3 handle 30: tbf rate 20kbit buffer 1600 limit 3000
tc filter add dev eth1 protocol ip parent 1:0 prio 3 u32 match ip src 31.13.85.0/24 flowid 1:3
tc filter add dev eth1 protocol ip parent 1:0 prio 3 u32 match ip src 179.232.0.0/14 flowid 1:3
<?php
define('TICKS_PER_SEC', 60);
define('SECTOR_SIZE', 16);
define('WALKING_SPEED', 5);
define('FLYING_SPEED', 15);
define('TERMINAL_VELOCITY', 50);
define('PLAYER_HEIGHT', 2);
@polaco1782
polaco1782 / Vagrantfile
Created March 12, 2020 18:10 — forked from tomoemon/Vagrantfile
sample Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
@polaco1782
polaco1782 / list_gcp_iprange.sh
Created May 11, 2020 21:11 — forked from n0531m/list_gcp_iprange.sh
Google Cloud Platform : ip address range
#!/bin/bash
# https://cloud.google.com/compute/docs/faq#find_ip_range
# nslookup -q=TXT _cloud-netblocks.googleusercontent.com 8.8.8.8
myarray=()
for LINE in `dig txt _cloud-netblocks.googleusercontent.com +short | tr " " "\n" | grep include | cut -f 2 -d :`
do
myarray+=($LINE)
for LINE2 in `dig txt $LINE +short | tr " " "\n" | grep include | cut -f 2 -d :`
@polaco1782
polaco1782 / squid-ut.cpp
Created December 11, 2020 18:16
Old Squid store-id integration
#include <cstdlib>
#include <string>
#include <sstream>
#include <vector>
#include <iostream>
#include <curl/curl.h>
namespace UT
{
CURL *handle;
@polaco1782
polaco1782 / moveit.c
Created July 19, 2023 18:03
mouse moving
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/Xlib.h>
#include <X11/keysym.h>
#include <X11/extensions/XTest.h>
Window findWindow(Display *display, Window window, const char *name) {
Window root, parent, *children;
unsigned int numChildren;
#include <windows.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
HWND findWindow(HWND hwnd, const char *name) {
char windowName[256];
GetWindowText(hwnd, windowName, sizeof(windowName));
if (strcmp(windowName, name) == 0) {
return hwnd;