Skip to content

Instantly share code, notes, and snippets.

View cardoni's full-sized avatar
:bowtie:

Greg Cardoni cardoni

:bowtie:
View GitHub Profile
remote 10.0.0.1 1194 # This points to the private IP of your OpenVPN server (and the OpenVPN port)
ca ca.crt
cert <vpn_client_name>.crt
key <vpn_client_name>.key
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
-A INPUT -i lo -j ACCEPT
-A INPUT -i tun0 -j ACCEPT
-A INPUT -p tcp -m tcp --dport 22 -j ACCEPT
-A INPUT -i eth1 -p udp -m udp --dport 1194 -j ACCEPT
-A INPUT -i eth1 -p tcp -m tcp --dport 1194 -j ACCEPT
@cardoni
cardoni / nginx_config_for_AB_testing.conf
Created February 2, 2015 19:09
Nginx Config for A/B testing (50%/50%)
##
## Nginx Config for A/B testing (50%/50%)
##
split_clients "abtest${remote_addr}${http_user_agent}${date_gmt}" $variant {
50% "abtest.your_domain.com/a_test.html";
* "abtest.your_domain.com/b_test.html";
}
server {
@cardoni
cardoni / es6.js
Last active August 29, 2015 14:15
es6 let
'use strict'
for( let x = 0; x < 1; x += 1 ) {
for( let x = 0; x < 20; x += 1 ) {
console.log( 'inside: ', x );
}
console.log( 'outside: ', x );
}
wordpos.getPOS( 'The angry bear chased the frightened little squirrel.', console.log );
// Output:
{
nouns: [ 'bear', 'squirrel', 'little', 'chased' ],
verbs: [ 'bear' ],
adjectives: [ 'little', 'angry', 'frightened' ],
adverbs: [ 'little' ],
rest: [ 'the' ]
}
wordpos.getNouns( 'The angry bear chased the frightened little squirrel.', console.log );
// Output:
[ 'bear', 'squirrel', 'little', 'chased' ]
@cardoni
cardoni / regex_to_parse_proper_nouns.js
Last active August 29, 2015 14:15
Regular Expression for Extracting Proper Nouns
/ \s+([ie]*-?[A-Z]+.*?)(?:\s+[a-z\W]|[`'’"^,;:—\\\*\.\(\)\[\]]) /
@cardoni
cardoni / mongo_queries.js
Last active August 29, 2015 14:16
Useful Mongo Shell Queries
// Returns an Array of all Mongo Collections
db.getCollectionNames();
// Returns Each Mongo Collection w/ Count
db.getCollectionNames().forEach( function ( col ) { print( col, db.getCollection( col ).stats()[ 'count' ] ) } );
// Regex Searching ( w/ Pretty Printing )
db.<collection_name_here>.find( { name: { $regex: /^regex_to_match_on_here/i } } ).pretty();
// Most-Recently-Added Record in Collection ( w/ Pretty Printing )
@cardoni
cardoni / fizzbuzz.rb
Last active August 29, 2015 14:19
quick ruby fizzbuzz
# encoding: UTF-8
class FizzBuzz
def initialize( times=100 )
@times = times.to_i
end
def count
( 1..@times ).count

Keybase proof

I hereby claim:

  • I am cardoni on github.
  • I am cardoni (https://keybase.io/cardoni) on keybase.
  • I have a public key whose fingerprint is C803 CC92 08C7 3E0F 31EA 3FA8 50D0 8132 BEE0 5ED2

To claim this, I am signing this object: