Skip to content

Instantly share code, notes, and snippets.

@CarlosMecha
CarlosMecha / index.html
Last active June 20, 2019 16:20
Adobe's Marketing Cloud Visitor ID
<html>
<head>
<title>Marketing Cloud Service</title>
<script>
window.organizationId = 'myOrganizationId';
window.region = 3;
</script>
<script src="./mcvid.js"></script>
</head>
<body>
@CarlosMecha
CarlosMecha / index.js
Created July 19, 2018 21:20
Redis reconnect
const redis = require('redis')
const util = require('util')
const backoff = require('backoff')
const interval = 1000
const port = process.env.REDIS_PORT || '6379'
const host = process.env.REDIS_HOST || 'localhost'
const b = new backoff.ExponentialStrategy({
initialDelay: 1000,
maxDelay: 60 * 1000
@CarlosMecha
CarlosMecha / main.go
Created June 4, 2018 20:17
Clone a GitHub repo with SSO Token using git2go
package main
import (
"fmt"
"os"
"gopkg.in/libgit2/git2go.v27"
)
func credentialsCallback(url, username string, t git.CredType) (git.ErrorCode, *git.Cred) {
@CarlosMecha
CarlosMecha / keybase.md
Created November 29, 2017 18:59
keybase.md

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@CarlosMecha
CarlosMecha / conf_external_display.sh
Created December 22, 2014 16:22
Display switch script.
#!/bin/bash
#
# A tinny script based on:
# http://hoyhabloyo.wordpress.com/2012/01/18/xfce-display-switching-dual-single-monitor/
# to configure automatically an external display.
#
{
INT_DISPLAY='LVDS1';
@CarlosMecha
CarlosMecha / backup.sh
Created December 22, 2014 16:20
A simple backup script.
#!/bin/bash
#
# Backup script.
# The backups are stored in /var/backups/local and the log
# in /var/logs/backup.log
#
# Parameters:
# $1 - File where all the references are stored.
#
@CarlosMecha
CarlosMecha / vimrc
Created December 22, 2014 15:57
Common Vim configuration.
runtime! debian.vim
" Splashscreen
set shortmess=I
syntax on
set nu
set smartindent
set softtabstop=4
set shiftwidth=4
@CarlosMecha
CarlosMecha / portable_wifi.sh
Created December 22, 2014 05:48
Script to turn your computer in a WiFi hotspot and a DHCP service.
#!/bin/bash
#
# Simple WIFI portable Hotspot.
# Requirements:
# * hostapd
# * dhcpd
#
# Tested in Debian environments.
#
@CarlosMecha
CarlosMecha / tmux.conf
Created December 22, 2014 05:17
Tmux common configuration.
#
# A fancy statusbar.
#
unbind C-b
set -g prefix C-a
set -g history-limit 10000
set -g set-titles on
set -g set-titles-string "#T"
set-window-option -g mode-keys vi
@CarlosMecha
CarlosMecha / color_prompt.sh
Created December 22, 2014 05:15
Bash prompt
#
# Color Bash prompt.
#
# Tested in Debian environments.
#
# Regular user.
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
# Root.