Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Achilleas Pipinellis axilleas

🏠
Working from home
View GitHub Profile
View download_parse_json.rb
require "rubygems"
require "json"
require "net/http"
require "uri"
uri = URI.parse("http://api.sejmometr.pl/posiedzenia/BZfWZ/projekty")
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Get.new(uri.request_uri)
@axilleas
axilleas / git.sh
Created Jun 5, 2014
Install gti script
View git.sh
#!/usr/bin/env bash
wget -O /etc/yum.repos.d/PUIAS_6_computational.repo https://gitlab.com/gitlab-org/gitlab-recipes/raw/master/install/centos/PUIAS_6_computational.repo
wget -O /etc/pki/rpm-gpg/RPM-GPG-KEY-puias http://springdale.math.ias.edu/data/puias/6/x86_64/os/RPM-GPG-KEY-puias
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-puias
yum-config-manager --enable PUIAS_6_computational
yum -y update
git --version
@axilleas
axilleas / openshift_rails.md
Created Aug 2, 2014
Notes on Redhat's OpenShift with Ruby on Rails
View openshift_rails.md

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 / db
Last active Aug 29, 2015 — forked from maellak-test/db
View 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]
View index.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 Aug 29, 2015
diaspora sidekiq failures
View sidekiq.md
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 Aug 29, 2015
Diaspora systemd services for unicorn and sidekiq
View diaspora.tmpfiles.d
d /run/diaspora 0755 diaspora diaspora -
View gitolab.php
#!/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
View gist:b0e7bc364a0bf44c998b
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:
View node-and-npm-in-30-seconds.sh
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