Skip to content

Instantly share code, notes, and snippets.

View ozh's full-sized avatar
🍷
More wine, please.

྅༻ Ǭɀħ ༄༆ཉ ozh

🍷
More wine, please.
View GitHub Profile
@ozh
ozh / .bash_profile
Last active November 26, 2021 03:35
.bash_profile for Git Bash
PS1='\[\033[32m$(pwd | sed -e 's!/d/home!-!')\033[36m $(__git_ps1 "%s")\033[0m\]
$ '
if [[ $(git rev-parse --git-dir 2> /dev/null) && -z "$GIT_MOTD" ]]; then
echo -e "\e[00;32m- \e[01;33mWelcome $(id -u -n)"
echo -e "\e[00;32m- \e[01;32mGIT BRANCH \e[00;32m-----------------------------------------------------\e[00m"
git branch
echo -e "\e[00;32m- \e[01;32mGIT STATUS \e[00;32m-----------------------------------------------------\e[00m"
git status
echo -e "\e[00;32m------------------------------------------------------------------\e[00m"
@ozh
ozh / gist:4131243
Created November 22, 2012 13:44
Create dot files/directories (ie .file) on Windows

#How to create a .file or .folder on Windows

There are several ways

1. Rename

  • Create file.txt
  • Rename to .file., the last dot will be dropped, you'll have .file

Works the same with a file or a directory.

@ozh
ozh / gist:4154909
Created November 27, 2012 15:41
Git trick: have a branch mirror another one

Git post-commit hook to keep master and gh-pages branch in sync :

In your Git repository create a file .git/hooks/post-commit and fill it with this:

#!/bin/sh
git checkout gh-pages
git rebase master
git checkout master
@ozh
ozh / gist:4190794
Created December 2, 2012 20:12
Notepad++ and Function List plugin

Function List Plugin on Notepad++ and Windows 7

  1. Download Function List Plugin
  2. Copy the files: C++.flb, FunctionListRules.xml, Gmod Lua.bmp to: [DRIVE LETTER]:\Users\[YOUR USER NAME]\AppData\Roaming\Notepad++\plugins\config
  3. Copy the file FunctionList.dll to your instaltion folder for example: [DRIVE LETTER]:\Program Files (x86)\Notepad++\plugins

Source: http://blog.amdaris.com/function-list-plugin-on-notepad-and-windows-7/

@ozh
ozh / updatewp.md
Last active April 14, 2024 22:55
Bash script: update WordPress to latest

Works with Dreamhost's hosting style: directories in ~ like /home/joe/blog.joe.com/

@ozh
ozh / ascii-wp-logo.txt
Created January 8, 2013 22:27 — forked from markjaquith/gist:4487609
WordPress logo - ascii style
<!--
`-/+osssssssssssso+/-`
./oys+:.` `.:+syo/.
.+ys:. .:/osyyhhhhyyso/:. ./sy+.
/ys: -+ydmmmmmmmmmmmmmmmmmmdy+- :sy/
/h+` -odmmmmmmmmmmmmmmmmmmmmmmmmmmdo- `+h/
:ho` /hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmds/ `oh:
`sy. /hmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmd+ .ys`
.ho `sdddhhhyhmmmdyyhhhdddddhhhyydmmmmy oh.
@ozh
ozh / .htaccess
Created January 16, 2013 22:24
Mediawiki short URL rewrite
RewriteEngine on
RewriteBase /mediawiki/
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?title=$1 [L,QSA]
@ozh
ozh / next_365_days.php
Created February 6, 2013 10:03
Generate list of all 365 days in PHP (aka strtotime() fun)
<?php
$now = time();
$a_year_later = strtotime('+1 Year', $now);
$all_days = array();
// starting today
$next = strtotime('+1 Day', strtotime('-1 Day', $now));
@ozh
ozh / github_oauth_token.md
Last active June 23, 2022 15:42
Get a Github OAuth token from the CLI with curl

At the command line:

curl -u ':USERNAME' -d '{"scopes":["public_repo"],"note":"Google Issues to GH"}' https://api.github.com/authorizations
curl -H "Authorization: bearer :TOKEN" https://api.github.com/users/:USERNAME -I

Replace :USERNAME with your Github username and :TOKEN with the oauth token you get from first curl

After that, the token will be listed in your Applications and you can revoke it from there

@ozh
ozh / new empty git branch.md
Last active May 2, 2024 07:39
Create a new empty branch in Git
$ git checkout --orphan NEWBRANCH
$ git rm -rf .

--orphan creates a new branch, but it starts without any commit. After running the above command you are on a new branch "NEWBRANCH", and the first commit you create from this state will start a new history without any ancestry.

You can then start adding files and commit them and they will live in their own branch. If you take a look at the log, you will see that it is isolated from the original log.