This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Proxy Auto-Config file, see http://en.wikipedia.org/wiki/Proxy_auto-config | |
This would work with most browsers and more, do not need any heavy plugins with this script and it's more powerful, flexible and maintainable than | |
any of plugins. Instead of clicking through menus, just point to this file anywhere in your FS. | |
*/ | |
function FindProxyForURL(url, host) { | |
/* example with using regex: | |
var regexpr = /[a-zA-Z]{4}.microsoft.com/; | |
if(regexpr.test(host)) { ... | |
*/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Remote Method Invocation (Remote Procedure Call) in Ruby. | |
# Four files rolled in one | |
# dRbUrl.rb BEGIN | |
require 'drb/drb' | |
module DrbTry | |
URL = 'druby://localhost:8787' | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sub Export_Macro() | |
Dim sChartName As String | |
Dim sPrompt As String | |
Dim sDefault As String | |
If ActiveSheet Is Nothing Then GoTo ExitSub | |
If ActiveChart Is Nothing Then GoTo ExitSub | |
sPrompt = "Chart will be exported into directory of active workbook." | |
sPrompt = sPrompt & vbNewLine & vbNewLine |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" | |
layout="vertical" | |
verticalAlign="middle" | |
backgroundColor="white" viewSourceURL="srcview/index.html"> | |
<mx:Style> | |
@namespace mx "library://ns.adobe.com/flex/mx"; | |
/*mx|ColumnChart { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/zsh | |
# rename a file from a subdirectory on the Git path. | |
NAME_FROM="$1" | |
NAME_TO="$2" | |
[[ -z $NAME_FROM || -z $NAME_TO ]] && { echo "Need name from and name to"; return 1 } | |
[[ -f $NAME_FROM ]] || { echo "$NAME_FROM is not a file"; return 2 } | |
[[ -f $NAME_TO ]] && { echo "File $NAME_TO exists"; return 3 } | |
function findgitroot { | |
local ORIG_DIR; ORIG_DIR=$PWD | |
GIT_ROOT='' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is a collection of shell snippets I used to tune up the Ubuntu 12.10 distribution to a development workstation without multimedia to run in a virt. | |
# Most of those commands were ran as root, see the first 2 comments under this code about getting to the root prompt in Ubuntu. | |
# now let's start with fresh Ubuntu install. | |
# toss out all this stuff, games, thunderbird (got Outlook on the Windows 7 host), samba (using VMWare's shared folders instead), | |
# pidgin (Using Lync on the host) etc, anything that eats up the space and clutters menus without giving me any leverage: | |
apt-get remove --purge --ignore-missing gbrainy aisleriot gbrainy gnome-games-* gnome-sudoku gnomine libgme0 mahjongg bogofilter* empathy* thunderbird* \ | |
remmina gwibber* tomboy avahi-daemon transmission-* whoopsie samba* modemmanager ubuntuone* rhythmbox* activity-log-manager-common python-zeitgeist \ | |
zeitgeist-core deja-dup pidgin* apport* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# To make foreign identifiers look more Java-ish way | |
# similar methods are in Rails, but if you don't want to drag the whole Rails around - can just include this. | |
class String # easier to copy it from Rails than dragging the Rails over | |
def camelize | |
return self.downcase.capitalize if self =~ /[A-Z]+/ && self !~ /_/ | |
return self.capitalize if self !~ /_/ | |
split('_').map { |e| e.capitalize }.join | |
end | |
def variablize |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* How to overload a define with different count of args in C or disable it altogether | |
build with: | |
gcc -D SAY_IT=1 testMultiDef.c -o testMultiDef.exe | |
depending on the SAY_IT value the SAY calls in the code will either talk or keep mum | |
*/ | |
#if defined(SAY_IT) && SAY_IT | |
// important to provide enough _1, _2 ... _N to provide the N args max | |
#define _N_SAY(_1, _2, _3, _4, NAME, ...) NAME | |
#define SAY(...) _N_SAY(__VA_ARGS__, SAY4, SAY3, SAY2, SAY1)(__VA_ARGS__) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cat javaList.txt | xargs -n 1 -I {} wget http://mirror.metrocast.net/apache/avro/avro-1.7.2/java/{} -O {} | |
cat javaList.txt | grep .asc | xargs -n 1 -I {} gpg -verify -v {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <sstream> | |
#include <iomanip> | |
using namespace std; | |
static const int POW_OF_2[] = {1, 2, 4, 8, 16}; | |
static const int COUNT_MASKS[] = {0x55555555, 0x33333333, 0x0F0F0F0F, 0x00FF00FF, 0x0000FFFF}; | |
unsigned int countByKernighanBrian(unsigned int src) { |
NewerOlder