Skip to content

Instantly share code, notes, and snippets.

View vndmtrx's full-sized avatar
🎲
Fazendo vários nadas

Eduardo N.S.R. vndmtrx

🎲
Fazendo vários nadas
View GitHub Profile
@vndmtrx
vndmtrx / js_class.js
Created August 3, 2016 15:12
OOP in Javascript
var MyClass = (function () {
// private static
var nextId = 1;
// constructor
var cls = function () {
// private
var id = nextId++;
var name = 'Unknown';
@vndmtrx
vndmtrx / caminho_transito.py
Last active August 19, 2020 18:00
Algoritmo para calcular a existência de caminhos em cruzamento.
grafo = {
'0': ['6'],
'1': ['2', '6'],
'2': ['1', '3', '7'],
'3': ['2'],
'4': ['3', '5'],
'5': ['4', '10'],
'6': ['0', '1', '7'],
'7': ['6', '12', '13'],
'8': ['3', '7', '9', '13'],
Atom sync configs
package br.com.vndmtrx.android.myapplication.util;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface LoadView {
package br.com.vndmtrx.android.myapplication;
import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.widget.RelativeLayout;
import android.widget.TextView;
public class DisplayMsg extends AppCompatActivity {
@vndmtrx
vndmtrx / iptables_example.rules
Last active August 31, 2015 15:01
A example iptables configuration with user chains to filter complex rules.
*filter
:INPUT DROP [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
:Invalid - [0:0]
:Accepted - [0:0]
:Prohibited - [0:0]
:Allow - [0:0]
:Finish - [0:0]
@vndmtrx
vndmtrx / serialwin.vbs
Last active September 25, 2023 21:38
Função VBS para salvar a chave de ativação atualmente em uso no Windows 7, 8, 8.1 e 10.
Option Explicit
'Código VBS para salvar a chave do Sistema para Windows 10, 8 e 7.
'Adaptado do site: http://winaero.com/blog/how-to-view-your-product-key-in-windows-10-windows-8-and-windows-7/
Dim objshell, Caminho, ChaveDigitalProduto, Result
Set objshell = CreateObject("WScript.Shell")
'Registra o path do registro onde está a chave do sistema
Caminho = "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"
'Chave de registro do sistema
@vndmtrx
vndmtrx / c11.cpp
Created August 15, 2015 18:33
A year or so ago I came up with this Gist, illustrating a bunch of modern C++ 11/14 features in a single function, which might not even look like C++ to a 1990’s developer.
#include <iostream>
#include <future>
using namespace std;
template <typename Fn, typename... Args>
auto do_async_with_log(ostream& os, Fn&& fn, Args&&... args)
-> future<decltype(fn(args...))>
{
os << "[TID=" << this_thread::get_id()
@vndmtrx
vndmtrx / fizzbuzz.py
Created December 23, 2014 20:45
FizzBuzz
#!/usr/bin/env python3
def fizzbuzz(x):
a = 0 if x % 3 else 1
a += 0 if x % 5 else 2
return ("{0}", "Fizz", "Buzz", "FizzBuzz")[a].format(x)
list(map(fizzbuzz, range(1, 101)))
@vndmtrx
vndmtrx / fizzbuzz.py
Last active August 29, 2015 14:12
FizzBuzz
#!/usr/bin/env python3
list(map(lambda x: ("FizzBuzz", "{0}", "{0}", "Fizz", "{0}", "Buzz",
"Fizz", "{0}", "{0}", "Fizz", "Buzz", "{0}", "Fizz",
"{0}", "{0}")[x%15].format(x), range(1, 101)))