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
| with table_stats as ( | |
| select psut.relname, | |
| psut.n_live_tup, | |
| 1.0 * psut.idx_scan / greatest(1, psut.seq_scan + psut.idx_scan) as index_use_ratio | |
| from pg_stat_user_tables psut | |
| order by psut.n_live_tup desc | |
| ), | |
| table_io as ( | |
| select psiut.relname, | |
| sum(psiut.heap_blks_read) as table_page_read, |
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
| import javax.inject.{Singleton, Inject} | |
| import com.google.inject.AbstractModule | |
| import play.api.db.{DBApi} | |
| import play.api.{Logger, Configuration} | |
| import org.jooq.util.GenerationTool | |
| import org.jooq.util.jaxb.{Target, Database, Generator} | |
| import play.api.db.evolutions.EvolutionsModule | |
| import play.api.Play.current |
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
| //EXAMPLE evolution.scala | |
| import java.io.{File, FilenameFilter} | |
| import com.datastax.driver.core.Session | |
| import org.apache.commons.io.filefilter.SuffixFileFilter | |
| import org.joda.time.{DateTime, DateTimeZone} | |
| import play.api.Play.current | |
| import play.api.{Logger, Play} |
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
| provider "heroku" { | |
| email = "[email protected]" | |
| api_key = "call heroku auth:token" | |
| } | |
| resource "heroku_app" "default" { | |
| name = "herokutest" | |
| region = "us" | |
| config_vars { |
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
| CREATE FUNCTION batch_at_will() RETURNS INTEGER LANGUAGE plpgsql AS $$ | |
| DECLARE batched_count INTEGER = 1; | |
| BEGIN | |
| WITH selected_users AS ( | |
| SELECT id | |
| FROM users | |
| WHERE role = 'moderator' | |
| AND registration_date < CURRENT_DATE - INTERVAL '4' YEAR | |
| LIMIT 1000 | |
| FOR UPDATE NOWAIT |
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 run: | |
| # curl -sSL https://gist.githubusercontent.com/sirkkalap/e87cd580a47b180a7d32/raw/d9c9ebae4f5cf64eed4676e8aedac265b5a51bfa/Install-Docker-on-Linux-Mint.sh | bash -x | |
| ########################################## | |
| # Check that HTTPS transport is available to APT | |
| if [ ! -e /usr/lib/apt/methods/https ]; then | |
| sudo apt-get update | |
| sudo apt-get install -y apt-transport-https | |
| fi |
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
| # Instruction Manual for the Executioner | |
| You knew that you would be the one to do this dirty | |
| task. | |
| You knew from the moment you saw the first warning | |
| signs: the servers capable of handling thousands of | |
| requests per second, but barely being utilized. | |
| You knew from the moment the CEO called that morning |
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
| import java.io.IOException; | |
| import java.net.URLClassLoader; | |
| import java.nio.file.Files; | |
| import java.nio.file.Paths; | |
| import java.nio.file.Path; | |
| /** | |
| * Example demonstrating a ClassLoader leak. | |
| * | |
| * <p>To see it in action, copy this file to a temp directory somewhere, |
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
| sudo wget http://repos.fedorapeople.org/repos/dchen/apache-maven/epel-apache-maven.repo -O /etc/yum.repos.d/epel-apache-maven.repo | |
| sudo sed -i s/\$releasever/6/g /etc/yum.repos.d/epel-apache-maven.repo | |
| sudo yum install -y apache-maven | |
| mvn --version |
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
| import org.jooq.util.jaxb.* | |
| import org.jooq.util.* | |
| ext.db = [ | |
| url: 'jdbc:postgresql://host/db', | |
| user: 'user', | |
| password: 'user', | |
| schema: 'schema' | |
| ] |