Skip to content

Instantly share code, notes, and snippets.

# https://catalog.workshops.aws/msk-labs/en-US/addingbrokers/reassignpartitions
$ cat <<EOF > topics-to-move.json
{ "topics": [ { "topic" : "my-topic"}], "version":1}
EOF
$ cat <<EOF > client.properties
security.protocol=SSL
# ...
EOF
@polera
polera / postgres_queries_and_commands.sql
Created November 20, 2020 23:06 — forked from rgreenjr/postgres_queries_and_commands.sql
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), 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(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@polera
polera / keybase.md
Last active November 15, 2019 18:40

Keybase proof

I hereby claim:

  • I am polera on github.
  • I am polera (https://keybase.io/polera) on keybase.
  • I have a public key ASCpOCOSz_GbpcP9NN4rixzv4HXiSn9Bu97LCMRzsNF2Pgo

To claim this, I am signing this object:

#!/bin/sh
. /etc/rc.subr
name="updateissue"
start_cmd="${name}_start"
stop_cmd=":"
updateissue_start()
{
@polera
polera / keymap.reg
Created August 23, 2013 12:22
Re-map caps lock to "CTRL" and left "CTRL" to caps lock. *** Create a backup of any registry key before you go importing registry keys willy-nilly ***
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,3a,00,1d,00,1d,00,3a,00,00,00,00,00
@polera
polera / pandas_questions.py
Created March 14, 2013 03:01
pandas_questions.py
import pandas as pd
"""
testdata.csv looks like this:
price1,price2,price3,type
20.00,40.00,60.00,20
40.00,10.00,30.00,10
3.00,15.00,47.42,20
"""
let reader = new TextFieldParser("need_mtg.csv")
reader.TextFieldType <- Microsoft.VisualBasic.FileIO.FieldType.Delimited
reader.Delimiters <- [|@","|]
reader.HasFieldsEnclosedInQuotes <- true
let data =
seq { while not reader.EndOfData do
yield reader.ReadFields() }
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using Aspose.Pdf;
using Aspose.Pdf.Kit;
namespace concat_pdfs
{
#light
open Microsoft.VisualBasic.FileIO
// Read in the CSV (Book2.csv)
let reader = new TextFieldParser("Book2.csv")
reader.TextFieldType <- Microsoft.VisualBasic.FileIO.FieldType.Delimited
reader.Delimiters <- [|@","|]
reader.HasFieldsEnclosedInQuotes <- true
#light
open System
[<EntryPoint>]
let main (args : string[]) =
if args.Length <> 1 then
failwith "Error: Expected arguments are <password_length>"
let password_length = args.[0]
let pool2 = List.concat [['a'..'z']; ['A'..'Z']; ['1'..'9']; ['!';'$';'#';'.']]