$ split -l 5000 users.csv ./split-files
5000 is the number of lines you want for each file.)
| export function distinctOn<Column extends AnyColumn>(column: Column) { | |
| return sql<Column["_"]["data"]>`distinct on (${column}) ${column}`; | |
| } | |
| export function jsonBuildObject<T extends SelectedFields>(shape: T) { | |
| const chunks: SQL[] = []; | |
| Object.entries(shape).forEach(([key, value]) => { | |
| if (chunks.length > 0) { | |
| chunks.push(sql.raw(`,`)); |
| // Credits to Louistiti from Drizzle Discord: https://discord.com/channels/1043890932593987624/1130802621750448160/1143083373535973406 | |
| import { sql } from 'drizzle-orm'; | |
| const clearDb = async (): Promise<void> => { | |
| const query = sql<string>`SELECT table_name | |
| FROM information_schema.tables | |
| WHERE table_schema = 'public' | |
| AND table_type = 'BASE TABLE'; | |
| `; |
| import java.io.InputStream | |
| import org.apache.spark.sql.execution.datasources.jdbc.JdbcUtils | |
| import org.apache.spark.sql.{ DataFrame, Row } | |
| import org.postgresql.copy.CopyManager | |
| import org.postgresql.core.BaseConnection | |
| val jdbcUrl = s"jdbc:postgresql://..." // db credentials elided | |
| val connectionProperties = { |
| #!/bin/sh | |
| # This assumes you have access to the system via SSH already, and need | |
| # remote VNC access as the same user, and you want only the primary display. | |
| export DISPLAY=:0 | |
| # Encoded password with http://www.motobit.com/util/base64-decoder-encoder.asp | |
| export VNC_PASSWORD="dm5jX3Bhc3N3b3JkNzE=" # vnc_password71 | |
| export VNC_PASSWORD="dm5jX3Bhc3M=" # vnc_password (a character limit is enforced?) | |
| # Sadly many common VNC clients don't support encryption. |
| # Backup | |
| docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql | |
| # Restore | |
| cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE | |
| import { useRef, useEffect } from "react"; | |
| import NProgress from "nprogress"; | |
| import Router from "next/router"; | |
| function useNProgress(showAfterMs = 300, options = {}) { | |
| const timer = useRef(null); | |
| function routeChangeStart() { | |
| const { showAfterMs } = this.props; | |
| clearTimeout(timer.current); |
| // JS array equivalents to C# LINQ methods - by Dan B. | |
| // Here's a simple array of "person" objects | |
| var people = [ | |
| { name: "John", age: 20 }, | |
| { name: "Mary", age: 35 }, | |
| { name: "Arthur", age: 78 }, | |
| { name: "Mike", age: 27 }, | |
| { name: "Judy", age: 42 }, | |
| { name: "Tim", age: 8 } |
Let Tomcat is download and installed under /opt/tomcat.
Also, let tomcat be a non-provileged user under which the server will be running.
We assume that we keep server's binaries under /opt/tomcat and we will create a server instance named foo under /var/tomcat/ (carrying its own conf, logs, webapps, work, lib directories).
See also https://dzone.com/articles/running-multiple-tomcat.
Create a template service unit file at /etc/systemd/system/[email protected]: