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
| # find running queries | |
| SELECT * FROM pg_stat_activity; | |
| # cancel the query | |
| SELECT pg_cancel_backend(<pid>) | |
| # if it won't die: | |
| SELECT pg_terminate_backend(<pid>) |
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
| -- copy query to CSV | |
| \copy (select * from some_table) TO '/tmp/query-xxx.csv' CSV HEADER | |
| -- dump table to SQL inserts | |
| pg_dump -h <host> -U <user> --schema=<schema> --table=<schema.table> --data-only --column-inserts <database> > output.sql |
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
| # test.conf | |
| input { | |
| file { | |
| path => "/tmp/some-file.log" | |
| start_position => beginning | |
| sincedb_path => "/dev/null" | |
| type => "some-type" | |
| } | |
| } |
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
| # all lines that don't start with [ are combined with the previous line | |
| [/var/log/some.log] | |
| type: some-type | |
| multiline_regex_before = ^[^[]].* |
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
| // based on an example at https://www.voip-info.org/asterisk-manager-example-php/ | |
| <?php | |
| /** | |
| * Connect to Asterisk Manager Interface (AMI). | |
| * | |
| * Setup an AMI user in /etc/asterisk/manager.conf | |
| */ | |
| class AsteriskManager { |
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
| # https://goenning.net/2017/01/25/adding-custom-data-go-binaries-compile-time/ | |
| # https://golang.org/cmd/link/ | |
| GIT_HASH=$(shell git rev-parse HEAD) | |
| FLAGS=-ldflags "-X main.version=$(GIT_HASH)" | |
| build: | |
| @go build $(FLAGS) | |
| run: |
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
| #!/bin/sh | |
| ### BEGIN INIT INFO | |
| # Provides: some-program | |
| # Required-Start: $remote_fs $syslog | |
| # Required-Stop: $remote_fs $syslog | |
| # Default-Start: 2 3 4 5 | |
| # Default-Stop: 0 1 6 | |
| # Short-Description: Some Program | |
| ### END INIT INFO |
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
| { echo -ne "HTTP/1.0 200 OK\r\nContent-Length: $(wc -c < test.html)\r\n\r\n"; cat test.html; } | nc -l 8081 |
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
| Math for programmers, http://www.elegantcoding.com/2011/06/math-for-programmers-tng.html | |
| How To Design Programs, https://htdp.org/ | |
| Structure And Interpretation of Computer Programs, http://mitpress.mit.edu/sites/default/files/sicp/index.html | |
| Category Theory, https://bartoszmilewski.com/2014/10/28/category-theory-for-programmers-the-preface/ | |
| Pivot Table with Java Streams, https://dzone.com/articles/java-pivot-table-using-streams | |
| Why you should know just a little AWK, https://gregable.com/2010/09/why-you-should-know-just-little-awk.html | |
| How to Write a Spelling Corrector, http://norvig.com/spell-correct.html | |
| Writing a Unix shell, https://indradhanush.github.io/blog/writing-a-unix-shell-part-1/ | |
| Metaballs, https://varun.ca/metaballs/ | |
| Simulating Vines, https://maissan.net/articles/simulating-vines |
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
| Debug: | |
| - https://facebook.github.io/react-native/docs/debugging | |
| - ios simulator: (shake gesture), debug JS remotely | |
| - android simulator: (cmd+m) |