Python
This file contains 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
import code; code.interact(local=dict(globals(), **locals())) |
This file contains 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 send the ip addres of the client/webbrowser to the server/webserver behind it there are a few options: | |
1- option forwardfor | |
2- send-proxy | |
3- source 0.0.0.0 usesrc clientip | |
1- option forwardfor | |
This is an easy option to configure in haproxy, it does require that http layer7 processing is used 'mode http' and the webserver/ webapplication that wants to log or use the ip of the client must use the http-header 'X-Forwarded-For' to read the clientip. | |
2- send-proxy / send-proxy-v2 / send-proxy-* | |
This is can be used both with mode tcp and http, it does however require that the server also understands the proxyprotocol. Some applications have added support for this protocol which adds a few bytes with ip information before the actual request. |
This file contains 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
/** | |
* Classes and Inheritance | |
* Code Example from http://www.es6fiddle.net/ | |
*/ | |
class Polygon { | |
constructor(height, width) { //class constructor | |
this.name = 'Polygon'; | |
this.height = height; | |
this.width = width; | |
} |
This file contains 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
# Updated for Ruby 2.3 | |
string_t = None | |
def get_rstring(addr): | |
s = addr.cast(string_t.pointer()) | |
if s['basic']['flags'] & (1 << 13): | |
return s['as']['heap']['ptr'].string() | |
else: | |
return s['as']['ary'].string() |
This file contains 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
8.2.3. HTTP log format | |
---------------------- | |
The HTTP format is the most complete and the best suited for HTTP proxies. It | |
is enabled by when "option httplog" is specified in the frontend. It provides | |
the same level of information as the TCP format with additional features which | |
are specific to the HTTP protocol. Just like the TCP format, the log is usually | |
emitted at the end of the session, unless "option logasap" is specified, which | |
generally only makes sense for download sites. A session which matches the | |
"monitor" rules will never logged. It is also possible not to log sessions for |
This file contains 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
# lib/omniauth-adwords-oauth2.rb | |
require "omniauth-google-oauth2" | |
class AdwordsOauth2 < OmniAuth::Strategies::GoogleOauth2 | |
option :name, 'adwords_oauth2' | |
end | |
# config/initializers/omniauth.rb | |
require "omniauth-adwords-oauth2" |
This file contains 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
var BaseObject = { | |
create: function create() { | |
var instance = Object.create(this); | |
instance._construct.apply(instance, arguments); | |
return instance; | |
}, | |
extend: function extend(properties, propertyDescriptors) { | |
propertyDescriptors = propertyDescriptors || {}; |
This file contains 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
#!/bin/bash | |
# | |
# Add latency to all outgoing traffic on $DEV on tcp/udp $PORT, | |
# in the amount of $DELAY. | |
# | |
# This is matching on both source port and destination port, which | |
# may hit you twice if you're accessing a local resource. | |
# | |
# To see what's currently in effect, | |
# tc -s qdisc show dev lo |
NewerOlder