Skip to content

Instantly share code, notes, and snippets.

@MarkRoddy
MarkRoddy / parse_s3_access_logs.sql
Last active February 28, 2024 18:42
DuckDB: Query S3 Access Logs
/*
Usage: you'll want to search for the strings <bucket> and <prefix>, and insert the S3 bucket where your access
logs are being delivered. Use (or delete) <prefix> to filter to a subset of your logs.
*/
/*
These commented out configuration settings you can either run yourself in the REPL and source this file using
`.read parse_s3_access_logs.sql`, or you can uncomment them and supply values for yourself.
tamar:~ mark$ python
Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> class Foo(object):
... class Bar(object):
... baz = 2
...
>>> Foo.Bar.baz
2
mark@localhost:~$ knife bootstrap help
Connecting to help
ERROR: Network Error: getaddrinfo: Name or service not known
Check your knife configuration and network settings
>>> s = "foo bar baz biz"
>>> any((s.__contains__(other) for other in ["foo", "bar", "baz", "bitz"]))
True
mark@localhost:~$ python
Python 2.6.6 (r266:84292, Jan 22 2014, 09:42:36)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-4)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> s = "foo bar baz biz"
>>> all(map(s.__contains__, ["foo", "bar", "baz"]))
True
>>> all(map(s.__contains__, ["foo", "bar", "baz", "bitz"]))
False
>>> any(map(s.__contains__, ["foo", "bar", "baz", "bitz"]))
for(var i=10; i<20; i++) { $("[for='chk" + i + "']").click() };
$("[add-directive-dmyx='delete-dmyx'] button").click();
$("#dialogButton_ok_myx button").click();
mark@localhost:~$ java -jar jython-standalone-2.5.4-rc1.jar
Jython 2.5.4rc1 (2.5:723492dbab02, Feb 8 2013, 10:13:55)
[Java HotSpot(TM) 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_45
Type "help", "copyright", "credits" or "license" for more information.
>>> from java.lang import Float
>>> def parseFloat(floatVal):
... return Float.parseFloat(floatVal)
...
>>> parseFloat(None)
Traceback (most recent call last):
import (
"github.com/jeromer/syslogparser/rfc3164"
"crypto/sha256"
<<<<<<< HEAD
. "github.com/go-check/check"
"testing"
=======
. "github.com/scalingdata/check"
"testing"
>>>>>>> SD-289 point references of go-check to our fork of the repo
:clean-expanded UP-TO-DATE
:lipstick-console:buildinfo
:lipstick-console:compileJava UP-TO-DATE
:lipstick-console:processResources
:lipstick-console:classes
:lipstick-console:hadoopJar
:lipstick-console:jar
:lipstick-server:clean-lib UP-TO-DATE
:lipstick-server:import-jar
:lipstick-server:debug
func dynFib(m int) int {
var inner func(n int) int
inner = func(n int) int {
switch {
case n == 0:
return 0;
case n == 1:
return 1;
default:
return inner(n-1) + inner(n-2)