Skip to content

Instantly share code, notes, and snippets.

Setting up RhodeCode on Ubuntu Server 12.04

Preparation

  1. Install Ubuntu Server.
  2. Update Ubuntu with the commands:
@miraculixx
miraculixx / gmail.py
Created March 2, 2015 15:31
Scrapy spider for Gmail API, using Django AllAuth as the token source
# -*- coding: utf-8 -*-
import base64
from items import EmailItem, EmailLabelItem
from loader import JSONItemLoader
from oauth2spider import OAuth2Spider
class GmailSpider(OAuth2Spider):
name = "gmail"
@lost-theory
lost-theory / netstat-2015.md
Last active September 10, 2018 11:25
netstat on all machines -> python -> graphviz -> png
$ knife ssh -m "...every host in the network..." "sudo netstat -nutap" -a hostname > meganetstat.txt
$ python
>>> from collections import Counter as C
>>> HS = "...every host in the network...".split()
>>> ip = lambda s: s.split(":")[0]
>>> xs = [map(ip, [x[0], x[4], x[5]]) for x in [x.strip().split() for x in open("meganetstat.txt").readlines() if "tcp" in x] if len(x)>=6]
>>> ipmap = [(h, C([x[1] for x in xs if x[0] == h])) for h in HS]
>>> ipmapx = dict([(sorted([(x,y) for (x,y) in ip[1].items() if x.startswith("10.")], key=lambda t: -t[1])[0][0], ip[0]) for ip in ipmap])
>>> sorted(C(map(ipmapx.get, [x[2] for x in xs if x[2].startswith("10.")])).items(), key=lambda t: t[1])
@stuart-warren
stuart-warren / readcert.sh
Created April 23, 2019 10:45
read cert from kubernetes
kubectl get secret <yourcert> -o=json | jq '.data["tls.crt"]' -r | base64 -d | openssl x509 -in /dev/stdin -text -noout
@smougenot
smougenot / A_Logstash.conf
Created July 26, 2012 13:59
Logstash Multiline Filter for Java Stacktrace (tested on field)
# stacktrace java as one message
multiline {
#type => "all" # no type means for all inputs
pattern => "(^.+Exception: .+)|(^\s+at .+)|(^\s+... \d+ more)|(^\s*Caused by:.+)"
what => "previous"
}
@witscher
witscher / tomcat.conf
Created June 13, 2012 13:24
Apache Tomcat Upstart script
description "Tomcat Server"
start on runlevel [2345]
stop on runlevel [!2345]
respawn
respawn limit 10 5
# run as non privileged user
# add user with this command:
## adduser --system --ingroup www-data --home /opt/apache-tomcat apache-tomcat
import jenkins.model.*
import com.cloudbees.plugins.credentials.*
import com.cloudbees.plugins.credentials.common.*
import com.cloudbees.plugins.credentials.domains.*
import com.cloudbees.plugins.credentials.impl.*
import com.cloudbees.jenkins.plugins.sshcredentials.impl.*
import org.jenkinsci.plugins.plaincredentials.*
import org.jenkinsci.plugins.plaincredentials.impl.*
import hudson.util.Secret
import hudson.plugins.sshslaves.*
@bcomnes
bcomnes / .screenrc
Last active August 21, 2022 10:33
ssh agent forwarding in tmux and gnu screen
# Fix agent forwarding
# https://gist.github.com/martijnvermaat/8070533
# http://techblog.appnexus.com/2011/managing-ssh-sockets-in-gnu-screen/
# See .ssh/rc for socket linking
unsetenv SSH_AUTH_SOCK
setenv SSH_AUTH_SOCK $HOME/.ssh/ssh_auth_sock.$HOSTNAME
@jonmorehouse
jonmorehouse / tar.go
Created February 17, 2014 22:29
Quick golang script for creating a gzipped tarball
package main
import (
"os"
"archive/tar"
"log"
"io"
"compress/gzip"
)
@karmi
karmi / elastic_search_ngram_analyzer_for_urls.sh
Created May 24, 2011 15:32
NGram Analyzer in ElasticSearch
# ========================================
# Testing n-gram analysis in ElasticSearch
# ========================================
curl -X DELETE localhost:9200/ngram_test
curl -X PUT localhost:9200/ngram_test -d '
{
"settings" : {
"index" : {
"analysis" : {