Skip to content

Instantly share code, notes, and snippets.

@vielhuber
vielhuber / script.sql
Last active February 19, 2022 23:07
PostgreSQL: Check if a constraint / foreign key exists #sql
-- example
SELECT COUNT(*) FROM information_schema.constraint_column_usage where constraint_name = 'table_name_foreign_table_id_foreign';
-- general
WITH
table_name AS (VALUES ('addresses')),
foreign_table_id AS (VALUES ('club_id'))
SELECT COUNT(*) > 0 FROM information_schema.constraint_column_usage where constraint_name = (TABLE table_name)||'_'||(TABLE foreign_table_id)||'_foreign';
-- get all foreign keys for specific table
@zchee
zchee / cgo.md
Last active June 25, 2024 14:49
cgo convert list

See also, http://libraryofalexandria.io/cgo/

Using Go cgo

cgo has a lot of trap.
but Not "C" pkg also directory in $GOROOT/src. IDE's(vim) Goto command not works.

So, Here collect materials.

@kengz
kengz / Deploying NodeJS App on Google Cloud Platform
Last active December 8, 2019 18:56
Deploying NodeJS App on Google Cloud Platform
# Deploying NodeJS App on Google Cloud Platform
`authored Jul 3 2015 by kengz`
## Installation
- Account with Google Cloud Platform.
- Install [Google Cloud Platform SDK](https://cloud.google.com/sdk/) to use `cloud` in the terminal.
- Install [Docker](https://cloud.google.com/tutorials/install-docker) for the VM container.
- Locally, login for the first time: `gcloud auth login`
@janikvonrotz
janikvonrotz / SQL Cheat Sheet.md
Last active April 18, 2024 18:08
SQL Cheat Sheet#SQL#Markdown

SQL languages

DDL is short name of Data Definition Language, which deals with database schemas and descriptions, of how the data should reside in the database.

DML is short name of Data Manipulation Language which deals with data manipulation, and includes most common SQL statements such SELECT, INSERT, UPDATE, DELETE etc, and it is used to store, modify, retrieve, delete and update data in database.

DCL is short name of Data Control Language which includes commands such as GRANT, and mostly concerned with rights, permissions and other controls of the database system.

Datatypes

Text types

@senthil245
senthil245 / JDK 1.6 Installation in Ubuntu
Created July 27, 2013 02:16
Step by step installation of JDK 1.6 in Ubuntu
Install Java JDK 6.0 update 31 on Ubuntu 12.04 LTS
Introduction
The first question is why are we installing an old JDK. The answer is that Oracle JDK 6.0 update 31 is the JDK recommended by Cloudera when installing CDH4 (Cloudera Distribution Hadoop v4).
This is an update to an older version of this post. Mainly I have changed the JDK from 1.6.0_26 to 1.6.0_31 as this is the recommended JDK for CDH4 .
Install Java
I have a 64 bit version of Ubuntu 12.04 LTS installed, so the instructions below only apply to this OS.