Skip to content

Instantly share code, notes, and snippets.

View davividal's full-sized avatar

Davi Koscianski Vidal davividal

View GitHub Profile
require "win32/registry"
interface_path = "SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters\\Interfaces"
Win32::Registry::HKEY_LOCAL_MACHINE.open(interface_path, Win32::Registry::KEY_READ) do |interfaces|
interfaces.each_key do |guid, _|
guid_path = "#{interface_path}\\#{guid}"
interface = Win32::Registry::HKEY_LOCAL_MACHINE.open(guid_path)
begin
<?php
//...
namespace Tests\ApiBundle\TestCase;
//...
use Liip\FunctionalTestBundle\Test\WebTestCase as WebTestCase;
//...
#!/bin/bash
PUPPET_SERVER_CANONICAL='foreman.company.tld'
EL_RELEASE=$(rpm -E %centos)
# Failed to determine EL_RELEASE. So, we are probably using Amazon Linux.
# And Amazon Linux is equivalent to EL 6
if [ $EL_RELEASE = '%centos' ]; then
EL_RELEASE=6
# Copied from http://jbisbee.blogspot.com.br/2013/07/add-history-and-tab-completion-to.html
try:
import readline
import rlcompleterimport atexit
import os
except ImportError:
print "Python shell enhancement modules not available."
else:
histfile = os.path.join(os.environ["HOME"], ".pythonhistory")
import rlcompleter
@davividal
davividal / .tmux.conf
Created January 20, 2015 17:45
Copied from somewhere: $HOME/.tmux.conf
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
set-option -g pane-border-fg colour235 #base02
set-option -g pane-active-border-fg colour240 #base01
set-option -g prefix C-a
bind-key C-a last-window
bind r source-file ~/.tmux.conf \; display-message "Config reloaded..."
@davividal
davividal / mediahint.js
Last active August 29, 2015 14:13 — forked from raul/mediahint.js
function FindProxyForURL(url, host){
var myip = myIpAddress();
var ipbits = myip.split(".");
var myseg = parseInt(ipbits[3]);
if(myseg == Math.floor(myseg/2)*2){
proxy = 'PROXY 165.225.131.153:80; PROXY 165.225.130.193:80';
} else {
proxy = 'PROXY 165.225.130.193:80; PROXY 165.225.131.153:80';
}
if((host == 'localhost')||(shExpMatch(host, 'localhost.*'))||(shExpMatch(host, '*.local'))||(host == '127.0.0.1')){