Skip to content

Instantly share code, notes, and snippets.

View tenken's full-sized avatar

David Gurba tenken

View GitHub Profile
@tenken
tenken / views_fs.callbacks.inc
Created May 23, 2012 22:47
Sample code to read remote files mounted for D7 access. This is just a working example and not an official module i support.
<?php
function views_fs_file_list_content() {
$page = array();
$files = _views_fs_fetch_filelist();
return $page;
}
@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 / 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 / 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.
#!/usr/bin/env bash
echo "Nooma.tv Recording Script"
hash recordmydesktop 2>/dev/null || { echo >&2 "I require recordmydesktop but it's not installed. Aborting."; exit 1; }
recordmydesktop --x=100 --channels 2 --freq 44100 --width 1200 -height 720 --follow-mouse --no-frame -o /home/dgurba/720.ogv &
PID=$!
sleep 9000
# Send recordmydesktop the Ctrl+C it wants to Stop recording.
kill -INT $PID
@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 / 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
{
"cap_add" : [],
"cap_drop" : [],
"cmd" : "",
"cpu_priority" : 0,
"ddsm_bind_share" : "",
"devices" : [],
"enable_publish_all_ports" : false,
"enable_restart_policy" : false,
"enabled" : true,
@tenken
tenken / .sh
Created October 21, 2016 21:03
Example of git diff --names-only usage on Project
dgurba at aw-dgurba in .../presidency/drupal7-project on master△
$ git diff --name-only master...add-sqlite-migrate-wizard
build/gemini/htdocs/sites/presidency-ets-gemini/modules/contrib/config_pages/CHANGES.TXT
build/gemini/htdocs/sites/presidency-ets-gemini/modules/contrib/config_pages/LICENSE.txt
build/gemini/htdocs/sites/presidency-ets-gemini/modules/contrib/config_pages/README.txt
build/gemini/htdocs/sites/presidency-ets-gemini/modules/contrib/config_pages/TODO.TXT
build/gemini/htdocs/sites/presidency-ets-gemini/modules/contrib/config_pages/config_pages.admin.inc
build/gemini/htdocs/sites/presidency-ets-gemini/modules/contrib/config_pages/config_pages.features.inc
build/gemini/htdocs/sites/presidency-ets-gemini/modules/contrib/config_pages/config_pages.field.inc
build/gemini/htdocs/sites/presidency-ets-gemini/modules/contrib/config_pages/config_pages.inc
@tenken
tenken / vbo-fast-bulk-selection.php
Created May 23, 2017 16:26
Example Prototype of fast item selection using VBO
<?php
// This example code is for D7. It uses a single hardcoded queue named essentially "workqueue_001".
// A relatively simple revision to this code may add a vbo_configurable form to the Action defintion
// to support any previously created EntityQueue as the list storage mechanism. Although in VBO-3.4
// this vbo_configurable attempt is breaking for me with a search_api based View display. Meh.
function prez_bulkadmin_action_info() {
return array(
'prez_bulkadmin_add_staff_work_queue_01' => array(