Skip to content

Instantly share code, notes, and snippets.

View jdrago999's full-sized avatar

jdrago999

  • San Francisco, CA
View GitHub Profile
export const datetimeWithTZ = <T extends ColumnBaseConfig>(
column: MySqlDateTimeString<T>
) =>
sql`DATE_FORMAT(${column}, '%Y-%m-%dT%TZ')`.mapWith((v) => new Date(v));
// example
// await db.select({ createdAt: datetimeWithTz(table.createdAt) }).from(table);
# API V2
## GET /api/v1/tools/user-agents
```
GET /api/v1/tools/user-agents
accept: application/json
```
### Example Response:
@jdrago999
jdrago999 / Thermoeconomics.md
Created January 28, 2023 21:18 — forked from clumma/Thermoeconomics.md
Thermoeconomics references

You can inherit the environment variables from PID 1 by iterating over the list of null-terminated strings in /proc/1/environ, parsing the first characters up to the first = as the variable name, setting the remaining value as that variable, and exporting it.

The Code Snippet

This works with multiline environment variables, and environment variables with arbitrary values, like strings, including = or JSON blobs.

Paste this in your current terminal session to inherit the environment variables from PID 1:

#!/bin/bash
set -eu
# Download and Install the Latest Updates for the OS
add-apt-repository 'deb http://archive.ubuntu.com/ubuntu trusty universe'
apt-get update
# Install MySQL Server in a Non-Interactive mode.
echo "mysql-server-5.6 mysql-server/root_password password $MYSQL_ROOT_PASSWORD" | sudo debconf-set-selections
@jdrago999
jdrago999 / US Zip Codes from 2013 Government Data
Created November 2, 2017 03:56 — forked from erichurst/US Zip Codes from 2013 Government Data
All US zip codes with their corresponding latitude and longitude coordinates. Comma delimited for your database goodness. Source: http://www.census.gov/geo/maps-data/data/gazetteer.html
This file has been truncated, but you can view the full file.
ZIP,LAT,LNG
00601,18.180555, -66.749961
00602,18.361945, -67.175597
00603,18.455183, -67.119887
00606,18.158345, -66.932911
00610,18.295366, -67.125135
00612,18.402253, -66.711397
00616,18.420412, -66.671979
00617,18.445147, -66.559696
@jdrago999
jdrago999 / setup-rabbitmq.sh
Last active August 23, 2017 06:24
Install RabbitMQ with basic configuration
#!/bin/bash
### Usage:
# RABBITMQ_DEFAULT_USER=someuser RABBITMQ_DEFAULT_PASS=secret123 RABBITMQ_DEFAULT_VHOST=myvhost setup-rabbitmq.sh
set -euo pipefail
apt-get update -y
apt-get install -y curl wget gnupg apt-transport-https
# Add Debian Wheezy backports repository to obtain init-system-helpers
@jdrago999
jdrago999 / webpack.nginx.conf
Created June 19, 2017 17:50 — forked from SiZapPaaiGwat/webpack.nginx.conf
webpack-dev-server configuration in nginx on development server
upstream ws_server {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name 10.1.2.225;
location / {
proxy_pass http://ws_server/;
@jdrago999
jdrago999 / gist:ca09953cf7fb6769565dcfd1beaea449
Created May 5, 2017 19:04 — forked from brianburridge/gist:11298396
How to load MySQL time zone tables from Mac OS time zone files

The easiest way to load the Mysql Time Zone tables from your Mac OS time zone fields is via this command:

mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql

However, on many systems like mine that will fail because some of the time zone information is incompatible with the database schema for the time zone tables.

Therefore, you'll want to load the time zone information into a text file and edit it to only include the time zones you need. (Or, attempt to find the data breaking the import.)

mysql_tzinfo_to_sql /usr/share/zoneinfo > zone_import.sql
@jdrago999
jdrago999 / install-consul.sh
Last active February 15, 2017 23:42 — forked from cbednarski/install-consul.sh
Ubuntu installer script for consul
#!/bin/bash -e
set -x
mkdir -p /tmp/consul
cd /tmp/consul
# Consul Configuration File
tee consul.json <<CONSULCONFIG
{