Skip to content

Instantly share code, notes, and snippets.

View telekosmos's full-sized avatar
💭
👻

Guillermo C. Martínez telekosmos

💭
👻
View GitHub Profile
@telekosmos
telekosmos / snapshot_utility.py
Created July 29, 2019 15:23 — forked from tomconte/snapshot_utility.py
Sample Python script to manage Azure Blob Storage snapshots: list snapshots, take a snapshot, delete a snapshot, copy a snapshot to a new Blob.
#!/usr/bin/python
from azure.storage import BlobService
import argparse
parser = argparse.ArgumentParser()
parser.add_argument("container", help="the blob container")
parser.add_argument("blob", help="the blob name")
parser.add_argument("-s", "--snapshot", help="take a new snapshot", action="store_true")
parser.add_argument("-d", "--delete", help="delete a snapshot")

Unix shell command output redirects

  • > file redirects stdout to file
  • 1> file redirects stdout to file
  • 2> file redirects stderr to file
  • &> file redirects stdout and stderr to file
@telekosmos
telekosmos / kafka-commands.md
Last active May 22, 2019 12:26
Kafka tools handy commands
@telekosmos
telekosmos / curl.md
Created April 11, 2019 13:08 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@telekosmos
telekosmos / drop-index.md
Created February 14, 2019 15:38
MsSQL 😩 things

You'll get the same exception if the index was created defining a PRIMARY KEY or UNIQUE constraint (ref).

In that case the simple solution is to use the ALTER-TABLE-command instead:

ALTER TABLE tbl1 DROP CONSTRAINT ix_cox

@telekosmos
telekosmos / remove-node_modules.sh
Created January 14, 2019 20:47
Remove node_modules recursively
find . -name "node_modules" -type d -prune -exec rm -rf '{}' +
/*
* AWS Sdk KMS spike: (assuming node v6.6+)
* 1 - Create master key at KMS
* 2 - Copy alias or ARN
* 3 - run this i.e.
* $ node spike.js KEY_ALIAS YOUR_PLAINTEXT_TO_ENCRYPT
*
* Taken from https://gist.github.com/raytung/f7dc78bb4310d02217111246da8cfdb3
*/
const AWS = require('aws-sdk');
@telekosmos
telekosmos / docker-start-run-exec.sh
Last active May 5, 2021 17:33
Docker handy statements
docker run -i -t <image> [<command>] # startup the container and run the <command> == /bin/bash inside
docker start -i -a <container> [<container>] # start some previously stopped containers
docker exec -i -t <container> <command> # run a command in a running container, <command> == /bin/bash
@telekosmos
telekosmos / permissions-user-schema.sql
Last active November 21, 2022 17:47
Redshift querying system tables
-- username and permissions for a particular schema
select u.usename,
has_schema_privilege(u.usename,s.schemaname,'create') AS user_has_select_permission,
has_schema_privilege(u.usename,s.schemaname,'usage') AS user_has_usage_permission
FROM pg_user u
cross join (select distinct schemaname from pg_tables) s
where u.usename = '<the_username>'
and s.schemaname = '<the_schemaname>';
@telekosmos
telekosmos / .zsh-update
Last active May 12, 2018 07:57
oh-my-zsh config
LAST_EPOCH=17654