Skip to content

Instantly share code, notes, and snippets.

View sobi3ch's full-sized avatar
🎯
Focusing

Piotr Sobieszczański sobi3ch

🎯
Focusing
View GitHub Profile
@sobi3ch
sobi3ch / .bashrc_ssh
Last active December 19, 2015 16:19 — forked from bluegraybox/.bashrc_ssh
#!/bin/bash
# Set up ssh-agent
SSH_ENV="$HOME/.ssh/environment"
function start_agent {
echo "Initializing new SSH agent..."
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > "${SSH_ENV}"
echo succeeded
chmod 600 "${SSH_ENV}"
. "${SSH_ENV}" > /dev/null
@sobi3ch
sobi3ch / l_lightbox.php
Created July 12, 2013 11:51
ATD render node in ligthbox
<?php
/**
* Render ATD node context inside lightbox.
*/
function l_lightbox($nid, $text) {
return l($text, '/lightbo/'. $nid, array('attributes' => array('class' => 'lightbox', 'rel'=> 'libghtframe')) );
}
@sobi3ch
sobi3ch / process_running.sh
Created September 9, 2013 12:25
Test if a given process is running. Assuming this form process list (ps).
#!/bin/bash
# Save process name to search
PROCESS=$1
# Change 'myapp' > '[m]yapp so grep don't count itself
GREP_PROCESS=`echo $PROCESS | sed 's/^\(.\)/[\1]/'`
# List processes, remove self command name and on the end count wanted process
COUNT=$(ps ax | grep -v $0 | grep -c -i $GREP_PROCESS)
@sobi3ch
sobi3ch / load_jquery_from_console.js
Created September 11, 2013 11:28
Load jQuery from any browser console. Just copy&paste into your console.
javascript:if(!window.jQuery||confirm('Overwrite\x20current\x20version?\x20v'+jQuery.fn.jquery))(function(d,s){s=d.createElement('script');s.src='https://ajax.googleapis.com/ajax/libs/jquery/1.8/jquery.js';(d.head||d.documentElement).appendChild(s)})(document);
@sobi3ch
sobi3ch / build.xml
Last active December 27, 2015 01:59
Phing: Potential error in attribute 'options' in filesync task. Always adding 'v' (verbose) on the end of options line whatever you put in options. 'verbose' options can be turn but I think that's not a solution. Below target will produce following command: [filesync] /usr/bin/rsync -av --exclude=sites/default/settings.phpv "/var/www/drupal/drup…
<?xml version="1.0" encoding="UTF-8"?>
<project name="TCS intranet" default="build" basedir="." description="a demo project">
<property name="project.name" value="intranet.childrenssociety.org.uk" />
<property name="rsync.sourcedir" value="/var/www/drupal/drupal-7.x/" />
<property name="rsync.destinationdir" value="/var/www/drupal/jenkins-drupal7/live" />
<target name="update-code" >
<filesync
sourcedir="${rsync.sourcedir}"
destinationdir="${rsync.destinationdir}"
@sobi3ch
sobi3ch / admin-recreate.sh
Created November 13, 2013 10:49
Recreating [Admin] button in OpenAtrium due to bug https://drupal.org/comment/8166761
drush en -y admin_views contextual_tabs ctools ctools_custom_content fape pm_existing_pages page_manager stylizer views_content defaultconfig bartik block color comment field field_sql_storage field_ui file filter image list menu node number options path search shortcut system taxonomy text update user date_all_day date_api date date_ical date_popup_authored date_popup date_repeat date_repeat_field date_views apps features features_override feeds conditional_fields entityreference field_group geofield link multiupload_filefield_widget flag trash_flag fullcalendar_colors fullcalendar fullcalendar_legend fullcalendar_options caption_filter image_resize_filter wysiwyg_filter mailsystem mimemail file_entity media_internet media media_vimeo media_youtube message_digest message message_notify message_subscribe message_subscribe_ui oa_responsive_regions oa_variables oa_admin oa_appearance oa_buttons oa_config oa_contextual_tabs oa_core oa_dashboard oa_date oa_diff oa_discussion oa_events_import oa_events oa_favorite
@sobi3ch
sobi3ch / install-all-bootstrap-components.sh
Last active December 30, 2015 05:09
What to do to smoothly run 'grunt' command in source bootstrap project. Made on Ubuntu 13.10. Run from home dir.
#!/bin/bash
# install all necessary packages
sudo apt-get update && sudo apt-get install -y libfontconfig1 ruby1.9.1-dev git zip nodejs npm
# install jekyll
sudo gem install jekyll --no-ri --no-rdoc
# link /usr/bin/nodejs > /usr/bin/node; phantomeJS has some problem if command is not strict 'node'. DEbian/ubuntu normally has 'nodejs'
sudo ln -s /usr/bin/nodejs /usr/bin/node
LOCALHOST:~/vagrant/my_ubuntu $ VAGRANT_LOG=debug vagrant up > log.txt
INFO global: Vagrant version: 1.3.5
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/guests/gentoo/plugin.rb
INFO manager: Registered plugin: Gentoo guest
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/guests/openbsd/plugin.rb
INFO manager: Registered plugin: OpenBSD guest
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/guests/solaris11/plugin.rb
INFO manager: Registered plugin: Solaris 11 guest.
DEBUG global: Loading core plugin: /opt/vagrant/embedded/gems/gems/vagrant-1.3.5/plugins/guests/ubuntu/plugin.rb
INFO manager: Registered plugin: Ubuntu guest
@sobi3ch
sobi3ch / gist:7908803
Created December 11, 2013 11:27
Vagrantfile for Ubuntu apache2 www-data with write permission for group
config.vm.synced_folder "./www", "/vagrant", :mount_options => ["dmode=775","fmode=664"], group: "www-data"