Skip to content

Instantly share code, notes, and snippets.

@trongthanh
trongthanh / gist:2779392
Last active June 25, 2024 08:04
How to move a folder from one repo to another and keep its commit history
# source: http://st-on-it.blogspot.com/2010/01/how-to-move-folders-between-git.html
# First of all you need to have a clean clone of the source repository so we didn't screw the things up.
git clone git://server.com/my-repo1.git
# After that you need to do some preparations on the source repository, nuking all the entries except the folder you need to move. Use the following command
git filter-branch --subdirectory-filter your_dir -- -- all
# This will nuke all the other entries and their history, creating a clean git repository that contains only data and history from the directory you need. If you need to move several folders, you have to collect them in a single directory using the git mv command.
@Fedalto
Fedalto / pre-receive
Created March 27, 2013 20:25
Git hook to make a git repository master branch read only. This should go in .git/hooks/
#!/usr/bin/env ruby
old_sha1, new_sha1, ref = gets.split
if ref == "refs/heads/master":
puts "Pushing to origin/master is not permitted."
puts "This is a read-only branch."
puts ""
puts "Create a new branch instead, or commit to SVN."
@markwalkom
markwalkom / logstash.conf
Last active April 29, 2022 10:23
Reindexing Elasticsearch with Logstash 2.0
input {
elasticsearch {
hosts => [ "HOSTNAME_HERE" ]
port => "9200"
index => "INDEXNAME_HERE"
size => 1000
scroll => "5m"
docinfo => true
scan => true
}
@nhocki
nhocki / poller.go
Last active December 2, 2023 11:38
Simple task scheduling with Redis & Go. Similar to Sidekiq's `perform_in` and `perform_at`.
// poller.go
package main
import (
"fmt"
"os"
"os/signal"
"time"
@bradrydzewski
bradrydzewski / build_latest.go
Last active April 14, 2016 22:32
Drone nightly build
package main
import (
"flag"
"log"
"strings"
"github.com/drone/drone-go/drone"
)
@mjf
mjf / prometheus-rules.yml
Last active September 23, 2022 15:13
Prometheus Recoding and Alert Rules Collection
# Prometheus Recoding and Alert Rules Collection
# Copyright (C) 2017 Matous Jan Fialka, <http://mjf.cz/>
# Released under the terms of The MIT License
groups:
- name: node_common
interval: 30s
rules: