Skip to content

Instantly share code, notes, and snippets.

View thebapi's full-sized avatar

Sajib Sarkar thebapi

View GitHub Profile
SELECT domainlookup.name as "domain_name", "Activity"."id", "Activity"."timestamp", "Activity"."device_id", "Activity"."userID", "Activity"."lookup_ID", "Activity"."reference_id", "Activity"."reference_type", "Activity"."notes", "Activity"."changes", "Activity"."show", "Activity"."created_at", "Activity"."updated_at", "Activity"."version", "lookup"."name" AS "lookup.name" FROM "events"."activities" AS "Activity" LEFT OUTER JOIN "events"."lookups" AS "lookup" ON "Activity"."lookup_ID" = "lookup"."id" LEFT OUTER JOIN "events"."domain_lookups" AS "domainlookup" ON "domainlookup"."id" = "Activity"."reference_type" ORDER BY "Activity"."timestamp" DESC;
abi.vsyscall32 = 1
debug.exception-trace = 1
debug.kprobes-optimization = 1
dev.cdrom.autoclose = 1
dev.cdrom.autoeject = 0
dev.cdrom.check_media = 0
dev.cdrom.debug = 0
dev.cdrom.info = CD-ROM information, Id: cdrom.c 3.20 2003/12/17
dev.cdrom.info =
dev.cdrom.info = drive name:
ALTER TABLE events.devices DROP COLUMN IF EXISTS "device_type" CASCADE;
ALTER TABLE events.devices
ADD COLUMN type character varying(15) default 'Canary-C';
ALTER TABLE events.collections
ADD COLUMN webhook_url text;
@thebapi
thebapi / read-access.sql
Created October 30, 2019 23:51 — forked from oinopion/read-access.sql
How to create read only user in PostgreSQL
-- Create a group
CREATE ROLE readaccess;
-- Grant access to existing tables
GRANT USAGE ON SCHEMA public TO readaccess;
GRANT SELECT ON ALL TABLES IN SCHEMA public TO readaccess;
-- Grant access to future tables
ALTER DEFAULT PRIVILEGES IN SCHEMA public GRANT SELECT ON TABLES TO readaccess;
@thebapi
thebapi / gist:16227e7d707c441a0ddf70ee62c5dd84
Created October 10, 2019 18:27
Postgres Determining which table can be AUTO VACCUAM
WITH vbt AS (SELECT setting AS autovacuum_vacuum_threshold FROM
pg_settings WHERE name = 'autovacuum_vacuum_threshold')
, vsf AS (SELECT setting AS autovacuum_vacuum_scale_factor FROM
pg_settings WHERE name = 'autovacuum_vacuum_scale_factor')
, fma AS (SELECT setting AS autovacuum_freeze_max_age FROM
pg_settings WHERE name = 'autovacuum_freeze_max_age')
, sto AS (select opt_oid, split_part(setting, '=', 1) as param,
split_part(setting, '=', 2) as value from (select oid opt_oid,
unnest(reloptions) setting from pg_class) opt)
@thebapi
thebapi / gist:aada7af37e5ade7c657fcabbf3b83d87
Created October 10, 2019 18:24
Postgres Determining which database need Auto Vaccuam
SELECT datname, age(datfrozenxid) FROM pg_database ORDER BY age(datfrozenxid) desc limit 20;
@thebapi
thebapi / 1_kubernetes_on_macOS.md
Created July 16, 2019 01:27 — forked from kevin-smets/1_kubernetes_on_macOS.md
Local Kubernetes setup on macOS with minikube on VirtualBox and local Docker registry

Requirements

Minikube requires that VT-x/AMD-v virtualization is enabled in BIOS. To check that this is enabled on OSX / macOS run:

sysctl -a | grep machdep.cpu.features | grep VMX

If there's output, you're good!

Prerequisites

brew install postgresql
initdb /usr/local/var/postgres
brew services start postgresql
createdb postgres;
CREATE USER postgres SUPERUSER;
CREATE DATABASE postgres WITH OWNER postgres;
import {AfterViewInit, Directive, ElementRef, Input, NgZone, OnDestroy} from '@angular/core';
import {Subject, fromEvent} from 'rxjs';
import {switchMap, map, takeUntil} from 'rxjs/operators';
@Directive({
selector: '[appDraggable]'
})
export class DraggableDirective implements AfterViewInit, OnDestroy {
db.events.createIndex({
"name": 1,
"customer_id": 1
}, {
"name": "name_1_cust_1",
"background": true
});