Skip to content

Instantly share code, notes, and snippets.

View tenken's full-sized avatar

David Gurba tenken

View GitHub Profile
@tenken
tenken / convert.sh
Created March 8, 2016 22:20 — forked from akost/convert.sh
Bash script for recursive file convertion windows-1251 --> utf-8
#!/bin/bash
# Recursive file convertion windows-1251 --> utf-8
# Place this file in the root of your site, add execute permission and run
# Converts *.php, *.html, *.css, *.js files.
# To add file type by extension, e.g. *.cgi, add '-o -name "*.cgi"' to the find command
find ./ -name "*.php" -o -name "*.html" -o -name "*.css" -o -name "*.js" -type f |
while read file
do
@tenken
tenken / windows-1251-convert.sh
Created March 3, 2016 23:58 — forked from mustangostang/windows-1251-convert.sh
Convert windows-1251 to utf-8
#!/bin/zsh
for file in ./**/*.php
do
iconv -f windows-1251 -t UTF-8 "$file" > "${file%.php}-utf8.php"
rm $file
mv ${file%.php}-utf8.php $file
done
@tenken
tenken / exec style aliases
Created February 7, 2016 16:56 — forked from hilbix/exec style aliases
`git exec` to exec command within GIT directory. `git top` to exec on submodule top level directory (somewhat).
git config --global alias.exec '!exec '
git config --global alias.top '!f() { GIT_TOP="${GIT_DIR%%/.git/modules/*}"; [ ".$GIT_TOP" != ".$GIT_DIR" ] && cd "$GIT_TOP"; exec "$@"; }; f'
# THIS IS PUBLIC DOMAIN.
#
# `git exec` executes something in the current GIT module's base directory. `git exec pwd` gives this base.
# Stolen from http://stackoverflow.com/questions/957928/is-there-a-way-to-get-the-git-root-directory-in-one-command/957978#comment9747528_957978
#
# `git top` is like `git exec`, but executes in the topmost GIT directory, even from within a GIT submodule.
@tenken
tenken / certchain.sh
Created January 18, 2016 01:52 — forked from joshenders/certchain.sh
Simple Bash function to visualize PKI chain-of-trust for a given domain
function certchain() {
# Usage: certchain
# Display PKI chain-of-trust for a given domain
# GistID: https://gist.github.com/joshenders/cda916797665de69ebcd
if [[ "$#" -ne 1 ]]; then
echo "Usage: ${FUNCNAME} <ip|domain[:port]>"
return 1
fi
local host_port="$1"
@tenken
tenken / initial.sh
Created January 17, 2016 18:27
Setting up GitLab with Docker
# If you already have a webserver running you most likely won't be able to get GitLab
# woring on ports 80 and 443. Port 22 should work because we change the default SSH
# port on the host during server provisioning.
HTTP_PORT=8080
HTTPS_PORT=8443
SSH_PORT=22
# Install Docker (don't use Ubuntu's repositories, they're out of date).
wget -qO- https://get.docker.com/ | sudo sh
@tenken
tenken / wol.rb
Last active August 29, 2015 14:21 — forked from zunda/wol.rb
#!/usr/bin/ruby
# wol.rb: sends out a magic packet to wake up your PC
#
# Copyright (c) 2004 zunda <zunda at freeshell.org>
#
# This program is free software. You can re-distribute and/or
# modify this program under the same terms of ruby itself ---
# Ruby Distribution License or GNU General Public License.
#