Skip to content

Instantly share code, notes, and snippets.

View viktorbenei's full-sized avatar

Viktor Benei viktorbenei

  • Bitrise Ltd (CTO & Cofounder)
  • Hungary
View GitHub Profile
<!-- Add the following lines to theme's html code right before </head> -->
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.0/jquery.min.js"></script>
<script src="http://static.tumblr.com/fpifyru/VCxlv9xwi/writecapture.js"></script>
<script src="http://static.tumblr.com/fpifyru/AKFlv9zdu/embedgist.js"></script>
<!--
Usage: just add <div class="gist">[gist URL]</div>
Example: <div class="gist">https://gist.github.com/1395926</div>
-->
#!/bin/bash
# NOTE: GID 20 is staff group -- see more with: dscl . list groups gid
DEFAULT_GID=20
DEFAULT_GROUP=staff
DEFAULT_SHELL=/bin/bash
DEFAULT_HOME_BASE=/Users
_DEBUG_ON=""
@viktorbenei
viktorbenei / JavaScript - RGB char code based
Last active August 29, 2015 14:04
Hexa color code generation from any text string
function generate_color_from_text(text) {
var redRandom = 0;
var greenRandom = 0;
var blueRandom = 0;
for (var i = 0; i < text.length; i++) {
var charCode = text.charCodeAt(i);
redRandom += charCode;
greenRandom += charCode+1;
blueRandom += charCode+4;
@viktorbenei
viktorbenei / gist:fb8f038f83cbe259bb27
Created August 10, 2014 05:49
Logentries OSX script fix
#!/bin/bash
#
# Create a symlink to python as python2:
# logentries agent/script tries to use python2 instead of python - on OS X there's no python2
#
sudo ln -s /usr/bin/python /usr/bin/python2
@viktorbenei
viktorbenei / gist:35541c42b9d4f5f213aa
Created August 10, 2014 06:10
Install Logentries agent on OS X
#!/bin/bash
function print_and_do_command {
echo "-> $ $@"
$@
}
function print_and_do_command_exit_on_error {
print_and_do_command $@
@viktorbenei
viktorbenei / bash_utils.sh
Last active August 29, 2015 14:05
Base bash "print and exit on error" utility functions
#!/bin/bash
#
# Prints the given command, then executes it
# Example: print_and_do_command echo 'hi'
#
function print_and_do_command {
echo " -> $ $@"
$@
}
@viktorbenei
viktorbenei / envtest.sh
Last active August 29, 2015 14:06
Quick bash tests
#!/bin/bash
echo "${HOME}"
echo
echo "---"
echo " Env:"
env
@viktorbenei
viktorbenei / bitrise_cocoapods_upgrade.sh
Created October 15, 2014 10:22
Upgrade CocoaPods on Bitrise
#!/bin/bash
#
# Prints the given command, then executes it
# Example: print_and_do_command echo 'hi'
#
function print_and_do_command {
echo " -> $ $@"
$@
}
@viktorbenei
viktorbenei / bitrise_xcode_versions.sh
Created November 1, 2014 15:20
Bitrise: list Xcode versions
#!/bin/bash
FILES=/Applications/Xcodes/Xcode*.app
for f in $FILES
do
echo "--------------"
echo "Switching to Xcode at: ${f}"
xcode_switch_arg="${f}/Contents/Developer"
sudo xcode-select --switch "${xcode_switch_arg}"
echo " Version info:"
xcodebuild -version
@viktorbenei
viktorbenei / bitrise_list_source_code_dir.sh
Created November 12, 2014 18:53
Bitrise: List the source code dir's content
#!/bin/bash
echo "---- Source Dir content:"
ls -alh "${BITRISE_SOURCE_DIR}"
echo "-------------------------"