Skip to content

Instantly share code, notes, and snippets.

@silviud
silviud / pre-receive
Last active August 29, 2015 14:01
Pre-receive git hook for chef versions
#!/opt/gitlab/embedded/bin/ruby
# pre-receive
def header
puts "##########################"
end
def error msg
header
puts "Can't accept your commit !"
@silviud
silviud / pre-receive.py
Created May 23, 2014 14:07
Git pre-receive python
#!/usr/bin/env python
import sys
import os
import subprocess
import re
def git(args, **kwargs):
environ = os.environ.copy()
if 'repo' in kwargs:
@silviud
silviud / post-receive.sh
Last active August 29, 2015 14:01
Post receive git bash
#!/bin/bash
#
#
git config user.email "[email protected]"
git config user.name "Git Automatic Tagger"
while read oldrev newrev refname
do
branch=$(git rev-parse --symbolic --abbrev-ref $refname)
@silviud
silviud / uninstall-chedk.sh
Last active August 29, 2015 14:02
uninstall chefdk
if [ -e /opt/chefdk ]; then
rm -rf /opt/chefdk
else
echo "can not found chefdk"
fi
rm /usr/bin/berks
rm /usr/bin/chef
rm /usr/bin/chef-apply
rm /usr/bin/chef-solo
#!/usr/bin/env bash
# file: ~/.virtualenvs/postmkvirtualenv
# This hook is run after a new virtualenv is activated.
# setup python interpretor and sitepackages
# for Sublime Text's SublimeCodeIntel plugin.
# codeintel looks in the root of any folder opened via `subl foldername`
# for foldername/.codeintel/config
# it also looks in ~/.codeintel/config
jQuery(function($) {
$('form[data-async]').live('submit', function(event) {
var $form = $(this);
var $target = $($form.attr('data-target'));
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),
@silviud
silviud / vim_folds.txt
Created July 28, 2014 19:56
vim folds
Vim folding commands
zf#j creates a fold from the cursor down # lines.
zf/string creates a fold from the cursor to string .
zj moves the cursor to the next fold.
zk moves the cursor to the previous fold.
zo opens a fold at the cursor.
zO opens all folds at the cursor.
zm increases the foldlevel by one.
zM closes all open folds.
zr decreases the foldlevel by one.
# Knife Configuration File.
#
# This is a Ruby DSL to set configuration parameters for Knife's
# general options. The default location for this file is
# ~/.chef/knife.rb. If multiple Chef repositories are used,
# per-repository configuration files can be created. A per repository
# configuration file must be .chef/knife.rb in the base directory of
# the Chef repository. For example,
#
# ~/Development/chef-repo/.chef/knife.rb
import sys
import time
import subprocess
import types
from tempfile import TemporaryFile
def remote_sh(target_host, login, password, command_text, stdout=None, stderr=None):
winrs_text = 'winrs -remote:{0} -username:{1} -password:{2} -noprofile {3}'.format(
target_host, login, password, command_text)
#print('winrs text: {0}\n'.format(winrs_text))
@silviud
silviud / nginx.conf
Last active August 29, 2015 14:06 — forked from plentz/nginx.conf
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048