Skip to content

Instantly share code, notes, and snippets.


Ricardo Cosme ricjcosme

View GitHub Profile

Disabling GNOME Tracker and Other Info

GNOME's tracker is a CPU and privacy hog. There's a pretty good case as to why it's neither useful nor necessary here:

After discovering it chowing 2 cores, I decided to go about disabling it.


ricjcosme /
Created Jan 16, 2021 — forked from mderazon/
Export all of Mongodb collections as csv without the need to specify fields
# fill in your details here
# first get all collections in the database
ricjcosme / gist:c6f4c72644cc9bf0e63db7acc54bf6fb
Created May 24, 2020
Resizing a filesystem using qemu-img and fdisk
View gist:c6f4c72644cc9bf0e63db7acc54bf6fb

Occasionally we will deploy a virtual instance into our KVM infrastructure and realize after the fact that we need more local disk space available. This is the process we use to expand the disk image. This process assumes the following:

  • You're using legacy disk partitions. The process for LVM is similar and I will describe that in another post.
  • The partition you need to resize is the last partition on the disk.

This process will work with either a qcow2 or raw disk image. For

ricjcosme / main.go
Created Apr 4, 2018
Command line base58 enc/dec in golang
View main.go
package main
import (
b58 ""
ricjcosme / gist:892e0e3f6f10120278962f3055df6212
Last active Nov 10, 2017
Generate kubectl delete commands for replica sets
View gist:892e0e3f6f10120278962f3055df6212
kubectl get --all-namespaces rs -o json|jq -r '.items[] | select(.spec.replicas | contains(0)) | "kubectl delete rs --namespace=\(.metadata.namespace) \("'
ricjcosme /
Created Sep 14, 2017
UDP proxy in python
import socket
from threading import Thread
class Proxy(Thread):
""" used to proxy single udp connection
def __init__(self, listening_address, forward_address):
print " Server started on", listening_address
ricjcosme / dump-restore
Created Sep 13, 2017
DUMP / RESTORE PostgreSQL Kubernetes
View dump-restore
// pod-name name of the postgres pod
// postgres-user database user that is able to access the database
// database-name name of the database
kubectl exec [pod-name] -- bash -c "pg_dump -U [postgres-user] [database-name]" > database.sql
// pod-name name of the postgres pod
// postgres-user database user that is able to access the database
// database-name name of the database
ricjcosme /
Created Sep 1, 2017
Reflection webserver - good for dev / debugging purposes
#!/usr/bin/env python
# Reflects the requests from HTTP methods GET, POST, PUT, and DELETE
# Written by Nathan Hamiel (2010)
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
from optparse import OptionParser
class RequestHandler(BaseHTTPRequestHandler):
def do_GET(self):

Keybase proof

I hereby claim:

  • I am ricjcosme on github.
  • I am ricjcosme ( on keybase.
  • I have a public key ASCznfQdhnrFDdZoDrWYG5hNSDZs7jQI_qqZg9F2mRnerQo

To claim this, I am signing this object:

import confluent_kafka
#import json
#import msgpack
c = confluent_kafka.Consumer({'bootstrap.servers': 'kafka', '': 'PyCharm_consumer',
'default.topic.config': {'auto.offset.reset': 'latest'}})
running = True
i = 0