Skip to content

Instantly share code, notes, and snippets.

View makeittotop's full-sized avatar

abhishek pareek makeittotop

  • Canada
  • 07:01 (UTC -07:00)
View GitHub Profile
Apache LogFormat and CustomLog Configuration Changes
Although Apache has a large number of options insofar as what gets logged is concerned, this article is going to focus on the combined log format, which typically involves logging the following items:
Remote Host (will use hostnames if apache is configured to look them up)
Remote logname (typically a dash but could contain the rfc1413-compliant remote user name)
Remote User (typically a dash unless apache is doing some kind of authentication)
Timestamp of when the request was received. This is the local time for the server locale.
The first line of the request (typically the request URI)
The status code returned by the server (after redirection has taken place)
% means "the current file"
As eugene y pointed out, % does indeed mean "the current file name". Another use for this in Vim is in substitution commands. For example, :%s/foo/bar means "in the current file, replace occurrences of foo with bar." If you highlight some text before typing :s, you'll see that the highlighted lines take the place of % as your substitution range.
:w isn't updating your file
One confusing part of this trick is that you might think :w is modifying your file, but it isn't. If you opened and modified file1.txt, then ran :w file2.txt, it would be a "save as"; file1.txt wouldn't be modified, but the current buffer contents would be sent to file2.txt.
Instead of file2.txt, you can substitute a shell command to receive the buffer contents. For instance, :w !cat will just display the contents.
test -> build -> release -> deploy
@makeittotop
makeittotop / puppet_codemanager
Last active May 30, 2016 19:45
code manager description
Under the hood, Code Manager uses r10k and the file sync service to stage, commit, and sync your code, automatically managing your directory environments and modules.
First, you’ll create a control repository with branches for each environment that you want to create (such as production, development, or testing). You’ll also create Puppetfiles for your environments, specifying exactly which modules to install in each environment. This allows r10k to create directory environments, based on the branches you’ve set up.
When you push code to your control repo, you’ll trigger Code Manager to pull that new code into a staging code directory (/etc/puppetlabs/code-staging). File sync then picks up those changes, pauses Puppet Server to avoid conflicts, and then syncs the new code to the live code directories on your Puppet masters.
[root@ip-12-0-1-211 httpd]# cat print_process_tree.sh
#!/usr/bin/env bash
process=$1
pgrep -lf "$process" | head -1 | pstree -p $(cut -d" " -f1);
echo 'Total count: ' $(pgrep -lf "$process" | wc -l)
[root@ip-12-0-1-211 httpd]# ./print_process_tree.sh ssh
sshd(2757)───sshd(2761)───bash(2762)───sudo(2793)───su(2794)───bash(2795)───bash(11445)─┬─pgrep(11446)
└─pstree(11448)
@andelf
andelf / sighup.go
Created June 29, 2013 05:25
golang process SIGHUP, HUP signal to reload configuration
// program
package main
import "os/signal"
import "os"
import "fmt"
import "syscall"
import "time"