Skip to content

Instantly share code, notes, and snippets.

View axilleas's full-sized avatar
🏠
Working from home

Achilleas Pipinellis axilleas

🏠
Working from home
View GitHub Profile
@axilleas
axilleas / openshift_rails.md
Created August 2, 2014 17:04
Notes on Redhat's OpenShift with Ruby on Rails

Example

https://github.com/openshift/rails4-example

Tips

  1. NOTE: To disable assets compilation use disable_asset_compilation marker.
  2. NOTE: You can prevent installing certain Gemfile group using: rhc env set BUNDLE_WITHOUT=groupname
  3. NOTE: You can commit .openshift/markers/force_clean_build to force a clean bundle. Just touch the file.
@axilleas
axilleas / perm.rb
Last active February 5, 2022 10:42
Permutations of a string
#!/usr/bin/env ruby
# Recursive method, print all strings permutations with length = str.length.
# Iterrate over each character of given string and recursively call
# string_permutations. Each time, a letter from str is stripped and added to elmt.
# When str.length reaches zero, print elmt.
def string_permutations(str, elmt='')
if str.length == 0
p [elmt]
else
@axilleas
axilleas / appearances_helper.rb
Last active June 29, 2016 18:29
GitLab helper for custom login page
# Find this file in app/helpers/appearances_helper.rb
# Discussion at http://axilleas.me/en/blog/2014/custom-gitlab-login-page/
module AppearancesHelper
def brand_item
true
end
def brand_title
'My Organization'
end
@axilleas
axilleas / db
Last active August 29, 2015 14:07 — forked from maellak-test/db
In file C:\xampp\htdocs\openeclass\install\install_db.php on line 684
Error: Unable to execute statement with error: "You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version for the right syntax to
use near ' `attempt_status` tinyint(4) NOT NULL DEFAULT 1, ' at line 9" (SQLSTATE=1064 ERROR=42000)
[Statement='CREATE TABLE IF NOT EXISTS `exercise_user_record` ( `eurid` INT(11) NOT NULL AUTO_INCREMENT
PRIMARY KEY, `eid` INT(11) NOT NULL DEFAULT 0, `uid` MEDIUMINT(8) UNSIGNED NOT NULL DEFAULT 0,
`record_start_date` DATETIME NOT NULL DEFAULT '0000-00-00 00:00:00', `record_end_date` DATETIME DEFAULT NULL,
`total_score` INT(11) NOT NULL DEFAULT 0, `total_weighting` INT(11) DEFAULT 0, `attempt` INT(11) NOT NULL DEFAULT 0),
`attempt_status` tinyint(4) NOT NULL DEFAULT 1, `secs_remaining` INT(11) NOT NULL DEFAULT '0')
DEFAULT CHARACTER SET=utf8' Elapsed=0.00097599999999998]
@axilleas
axilleas / index.php
Created October 14, 2014 17:11
maellak php
<html>
<body>
<form action="movies.php" method="post">
<p>Pick Category
<select name="catMovie">
<option value="">Select...</option>
<option value="comedy">Comedy</option>
<option value="drama">Drama</option>
<option value="horror">Horror</option>
@axilleas
axilleas / sidekiq.md
Last active August 29, 2015 14:10
diaspora sidekiq failures
Federated::Relayable#parent_author delegated to parent.author, but parent is nil: #

lib/diaspora/relayable.rb:24:in `rescue in parent_author' 
lib/diaspora/relayable.rb:21:in `parent_author'
lib/postzord/receiver/public.rb:73:in `xml_author'
lib/postzord/receiver.rb:16:in `author_does_not_match_xml_author?'
lib/postzord/receiver/public.rb:60:in `save_object'
lib/postzord/receiver/public.rb:26:in `receive!'
lib/postzord/receiver.rb:12:in `perform!'
@axilleas
axilleas / diaspora.tmpfiles.d
Last active August 29, 2015 14:12
Diaspora systemd services for unicorn and sidekiq
d /run/diaspora 0755 diaspora diaspora -
#!/usr/bin/php -qC
<?php
/******************************************************************************
*
* @file gitolab.php
* @author Benoit Zohar
* @link http://benoitzohar.fr/
* @last-edited 2015-01-09
* @description Migrate projects from Gitolite to GitLab
BEFORE:
sam@ubuntu discourse % rm -fr tmp/cache
sam@ubuntu discourse % rm -fr public/assets
sam@ubuntu discourse % time RAILS_ENV=production bin/rake assets:precompile
58.55s user 1.79s system 100% cpu 1:00.02 total
AFTER:
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/v0.10.37/node-v0.10.37-linux-x86.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.com/install.sh | sh