Skip to content

Instantly share code, notes, and snippets.

View fuzzmz's full-sized avatar

Serban Constantin fuzzmz

View GitHub Profile
@fuzzmz
fuzzmz / redirect.html
Created December 4, 2012 11:06
HTML redirect
<html>
<head>
<title>Your Page Title</title>
<meta http-equiv="REFRESH" content="0;url=http://www.the-domain-you-want-to-redirect-to.com">
</head>
<body>
Optional page text here.
</body>
</html>
@fuzzmz
fuzzmz / replace.ps1
Created December 9, 2012 19:53
PowerShell replace in filename
get-childitem *.mp3 | foreach { rename-item $_ $_.Name.Replace(" ", "_") }
@fuzzmz
fuzzmz / 2array.ps1
Created December 9, 2012 19:58
powershell display 2 dimensional array
$a=,@(1,2,3)
$a+=,@(4,5,6)
foreach ($b in $a) {"$b"}
@fuzzmz
fuzzmz / middle_find
Created March 21, 2013 16:11
grep regex to match string with known beginning and end but whatever characters in between
$ grep ^start.*end$
@fuzzmz
fuzzmz / email.sh
Created March 30, 2013 22:55
Script to send email on Debian based server at shutdown and restart.
#!/bin/sh
### BEGIN INIT INFO
# Provides: SystemEmail
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Send email
# Description: Sends an email at system start and shutdown
### END INIT INFO
@fuzzmz
fuzzmz / empty_rpm.md
Last active January 14, 2024 09:12
How to build an empty .rpm file

How to create an empty .rpm file

First create a package_name.spec file with the following content:

Summary: Summary here
Name: package_name
Version: 0
Release: 0

License: Public

@fuzzmz
fuzzmz / accurev_wksp_change.md
Created May 16, 2013 11:04
Change accurev workspace location on disk

How to change the location of an AccuRev workspace on disk

Let's say that you moved your workspace from the folder in which you initially created it and now want to make AccuRev aware of the new location for the files.

In order to change the location of a workspace the following command must be used:

accurev chws -w foo_workspace -l .

Notes:

@fuzzmz
fuzzmz / vbox_start.sh
Created August 22, 2013 14:16
Shell script to start a headless virtualbox vm from a snapshot.
#!/bin/bash
EXPECTED_ARGS=2
if [ $# -ne $EXPECTED_ARGS ]; then
echo "Usage: $0 VMNAME_or_UUID SNAPSHOTNAME"
exit 1
fi
set -x
VBoxManage controlvm "$1" poweroff #enforce turnoff
VBoxManage snapshot "$1" restore "$2" #restore snapshot
@fuzzmz
fuzzmz / git_lg.md
Last active December 24, 2015 12:58
Git pretty graphical log

git config --global alias.lg "log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"

This will display:

  • one commit per line
  • show graph of commits
  • abbreviated commit IDs
  • dates relative to now
  • show commit references
  • colors
@fuzzmz
fuzzmz / default.hbs
Created November 11, 2013 21:30
Google+ content - profile linking
<footer class="site-footer">
<a class="subscribe icon-feed" href="{{@blog.url}}/rss/"><span class="tooltip">Subscribe!</span></a>
<div class="inner">
<section class="copyright"><p>Find me on <a href="https://twitter.com/fuzzmz" target="_blank">Twitter</a> and <a href="https://plus.google.com/109419825267811970601/?rel=author" target="_blank">Google+</a></p><p>All content copyright <a href="/">{{@blog.title}}</a> &copy; 2013 &bull; All rights reserved.</p></section>
<section class="poweredby">Proudly published with <a class="icon-ghost" href="http://ghost.org">Ghost</a></section>
</div>
</footer>