Skip to content

Instantly share code, notes, and snippets.

View fcharlier's full-sized avatar
🏠
Working from home

François Charlier fcharlier

🏠
Working from home
  • RedHat
  • Paris, France
View GitHub Profile
@goneri
goneri / prepare_rhel.sh
Last active February 23, 2018 20:59
Prepare RHEL
subscription-manager register
pool_id=$(subscription-manager list --available --matches 'Instructor SKU for Red Hat Training product downloads' --pool-only|head -n1)
subscription-manager attach --pool ${pool_id}
subscription-manager repos '--disable=*' --enable=rhel-7-server-rpms --enable=rhel-7-server-optional-rpms --enable=rhel-7-server-extras-rpms --enable=rhel-7-server-openstack-10-rpms
yum install -y tmux vim
@mdbooth
mdbooth / nova-compute-maintenance.py
Last active October 2, 2017 20:17
Put a nova compute node into 'maintenance mode'. Disable its service, and attempt to migrate all instances on it to other nodes.
#!/usr/bin/env python
import argparse
from collections import defaultdict
import os
import sys
import time
from novaclient import client
from novaclient import exceptions
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright 2015 François Charlier <francois.charlier@enovance.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
@chmouel
chmouel / znc-add-user.sh
Last active May 3, 2016 14:25
Script to add user, to copy and paste in your irc buffer to create the user as admin and send the other part to the user for infos
#!/bin/bash
USER=$1
REALNAME=$2
PASS=$(pwgen -B -s -n 12 1)
if [[ -z ${USER} || -z ${REALNAME} ]];then
echo "znc-add-user.sh: login realname"
exit 1
fi
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@jeetsukumaran
jeetsukumaran / pythonloc.vim
Created July 18, 2012 17:42
Report the class name and method or function name of current location in a Python buffer open in Vim
" based on:
" http://vim.1045645.n5.nabble.com/editing-Python-files-how-to-keep-track-of-class-membership-td1189290.html
function! s:get_last_python_class()
let l:retval = ""
let l:last_line_declaring_a_class = search('^\s*class', 'bnW')
let l:last_line_starting_with_a_word_other_than_class = search('^\ \(\<\)\@=\(class\)\@!', 'bnW')
if l:last_line_starting_with_a_word_other_than_class < l:last_line_declaring_a_class
let l:nameline = getline(l:last_line_declaring_a_class)
let l:classend = matchend(l:nameline, '\s*class\s\+')
@stephenc
stephenc / gist:3053561
Created July 5, 2012 13:05
Continuous Deployment with Jenkins and Puppet

Puppet with Jenkins

Setup Jenkins

With Puppet:

puppet module install rtyler-jenkins

puppet apply -v -e "include jenkins"

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 24, 2024 14:56
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@mhoran
mhoran / mailcomplete.vim
Last active December 1, 2022 01:10
goobook omnicomplete with awk ported to vimscript!
" http://recursivedream.com/blog/2012/auto-completing-google-contacts-in-vim/
" Escape query and handle goobook errors
function! mailcomplete#Complete(findstart, base)
if a:findstart == 1
let line = getline('.')
let idx = col('.')
while idx > 0
let idx -= 1
let c = line[idx]
" break on header and previous email
@chalmerj
chalmerj / gist:1492384
Created December 18, 2011 04:39
Init script for Graphite carbon-cache
#! /bin/sh
### BEGIN INIT INFO
# Provides: carbon-cache
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: carbon-cache init script
# Description: An init script for Graphite's carbon-cache daemon.
### END INIT INFO