Skip to content

Instantly share code, notes, and snippets.

View donkeysharp's full-sized avatar
💭
Breaking it... Fixing it... Dreaming it... Coding it...

Sergio Guillen donkeysharp

💭
Breaking it... Fixing it... Dreaming it... Coding it...
View GitHub Profile
@tonyc
tonyc / gist:1384523
Last active February 6, 2023 04:05
Using strace and lsof

Using strace and lsof to debug blocked processes

You can use strace on a specific pid to figure out what a specific process is doing, e.g.:

strace -fp <pid>

You might see something like:

select(9, [3 5 8], [], [], {0, 999999}) = 0 (Timeout)

@kkiernan
kkiernan / create.py
Last active December 27, 2022 09:25
import sublime, sublime_plugin, re
class CreateCommand(sublime_plugin.TextCommand):
# Runs the plugin
def run(self, edit, stub, offset):
self.view.insert(edit, offset, stub)

Creating a redis Module in 15 lines of code!

A quick guide to write a very very simple "ECHO" style module to redis and load it. It's not really useful of course, but the idea is to illustrate how little boilerplate it takes.

Step 1: open your favorite editor and write/paste the following code in a file called module.c

#include "redismodule.h"
/* ECHO <string> - Echo back a string sent from the client */
int EchoCommand(RedisModuleCtx *ctx, RedisModuleString **argv, int argc) {
@gmr
gmr / 0-auto-manged-chef-repo.md
Last active February 8, 2018 22:45
This gist has files that are used to automate chef repository submodules used for roles, data bags, cookbooks and environments, ultimately uploading the maintained chef repository to chef via knife using Jenkins and Github.

The files in this gist are for having Jenkins automatically manage a chef repository using git submodules. This allows for clean, clutter free management of individual cookbooks, and individual respositories for roles, environments and data bags in our chef-repo.

The process relies on using Github (we use Github Enterprise) and Jenkins in combination with the Jenkins Github plugin to notify Jenkins when a repository has changed.

Our chef-repo directory looks something like:

chef-repo
    - cookbooks
          - Each cookbook is a git submodule managed by Jenkins
    - data_bags (git submodule managed by Jenkins)
@grncdr
grncdr / build_artifact.py
Created August 10, 2011 00:20
script to pack up a python project and all of it's dependencies in a tarfile using virtualenv
import subprocess
import shutil
import os
import sys
import tarfile
def get_version(project_root):
process = subprocess.Popen(
['git', 'describe'],
stdout=subprocess.PIPE,