Skip to content

Instantly share code, notes, and snippets.

View 2color's full-sized avatar
🚢

Daniel Norman 2color

🚢
View GitHub Profile
@2color
2color / postgres_queries_and_commands.sql
Created September 6, 2017 13:19 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(query_start, clock_timestamp()), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(query_start, clock_timestamp()), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
Emoji Meaning
⚠️ WIP
Done
Not Done
🎆 Serendipitous
@2color
2color / nginx.conf
Created October 18, 2017 06:56 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048

Keybase proof

I hereby claim:

  • I am 2color on github.
  • I am 2color (https://keybase.io/2color) on keybase.
  • I have a public key whose fingerprint is EF85 B9E9 3F47 D488 56BF 37AF C466 A8FA 57F3 9905

To claim this, I am signing this object:

@2color
2color / credentials-example.yaml
Last active January 31, 2018 13:28
Concourse Snippets
github-access-token: "......"
slack-notifications-webhook: http://hooks.slack.com.......
gcr-key: |
{
"type": "service_account",
"project_id": "myproject"
}
git-private-key: |-
-----BEGIN RSA PRIVATE KEY-----
...
@2color
2color / README.md
Last active March 5, 2018 07:53 — forked from willejs/README.md
Moving Concourse Pipelines

Moving Concourse Pipelines

Intro

Currently concourse does not support moving pipelines between teams via fly CLI. There is an issue for that here

The only way to do this is to make a few changes in the DB.

If you run the statement below you will see that 6 tables have the team_id column.

concourse=> select table_name                                                                                                                                                                                                                                                                                                                                                       from INFORMATION_SCHEMA.COLUMNS                                                                                                                                                                                                                                                                   
{
"key": "%XeDqVs7hGP1g36xG+u8mCcy6yp+G4QrC25tO/8RmTzA=.sha256",
"value": {
"previous": "%7HOW+sn5+LqSn48AFkhHLUkLIVCpljzGbBoIo+P25wo=.sha256",
"author": "@QGXfP5kyNOnxhuf6+d9nSDPwSu55vjEdmKOecegeQso=.ed25519",
"sequence": 34,
"timestamp": 1543250630956,
"hash": "sha256",
"content": {
"type": "contact",
@2color
2color / defafultObjectProps.js
Created January 10, 2019 09:19
Default method parameters can access object properties
class Person {
constructor (name) {
this.name = name
this.defaultSalultation = 'Dr.'
}
sayHello (salutation = this.defaultSalultation) {
return `Hello ${salutation} ${this.name}`
}
}
@2color
2color / publishReplay.js
Last active January 10, 2019 16:05
Example of how publishReplay works
// https://jsbin.com/gacexawuju/edit?js,console
//emit value every 1 second
const source = Rx.Observable.interval(1000).take(5);
const example = source
//side effects will be executed once
.do(() => console.log('Do Something!'))
//do nothing until connect() is called
// Cache the last 3 values
.publishReplay(3)

Trigger cronjob manually

kubectl create job --from=cronjob/[CRONJOB] test-job-name