Skip to content

Instantly share code, notes, and snippets.

Avatar

Leonardo C. Daronco daronco

View GitHub Profile
@daronco
daronco / solution.md
Last active Oct 14, 2020
Dependency errors trying to install aptitude on Ubuntu 18.04 on DigitalOcean
View solution.md

Got the following errors trying to install aptitude on a clean Ubuntu 18.04 on DigitalOcean:

$ sudo apt install aptitude

The following packages have unmet dependencies:
 aptitude : Depends: libapt-pkg6.0 (>= 1.9.11~) but it is not installable
            Depends: libboost-iostreams1.71.0 but it is not installable
            Depends: libcwidget4 (>= 0.5.18-1) but it is not going to be installed
            Depends: libgcc-s1 (>= 3.0) but it is not installable
View install_moodle3x.sh
MOODLE_HOME="/var/www/moodle"
MOODLE_DATA="/var/www/moodle/moodledata"
sudo mkdir -p $MOODLE_DATA/lang/pt_br
cd $MOODLE_HOME
sudo wget https://github.com/mconf/moodle-mod_bigbluebuttonbn/archive/v2.2-elos.zip
sudo unzip v2.2-elos.zip
sudo mv moodle-mod_bigbluebuttonbn-2.2-elos mod/bigbluebuttonbn
cp mod/bigbluebuttonbn/lang/pt_br/bigbluebuttonbn.php $MOODLE_DATA/lang/pt_br/bigbluebuttonbn.php
@daronco
daronco / letsencrypt-webroot-apache.md
Last active Oct 6, 2020
Letsencrypt with webroot on Apache
View letsencrypt-webroot-apache.md

Config Apache with /etc/apache2/conf-available/le.conf:

Alias /.well-known/acme-challenge/ "/var/www/html/.well-known/acme-challenge/"
<Directory "/var/www/html/">
    AllowOverride None
    Options MultiViews Indexes SymLinksIfOwnerMatch IncludesNoExec
    Require method GET POST OPTIONS
</Directory>
@daronco
daronco / gist:95042bca628fb6924286
Last active Aug 29, 2015
Using setConfigXML in the API Mate
View gist:95042bca628fb6924286
  • Access the API Mate: http://mconf.github.io/api-mate/

  • Create a new meeting.

  • Join this meeting to make sure it won't be removed from the server in case you take too long to run the other steps.

  • Use getDefaultConfigXML via GET to get the default config.xml.

  • Copy and paste this config.xml into a new file. Edit it to remove any special characters (e.g. you might have HTML tags in the copyright field, so you have to remove or escape them).

  • Edit your config.xml according to your needs.

  • Put the edited XML content in the "XML for setConfigXML via POST" field in the API Mate.

  • Instead of using the API Mate to call setConfigXML (don't just click in the link), use another tool that runs outside of the browser. curl is a good option. First, copy the link the API Mate generated to setConfigXML. It will be a really long URL. Then use it with curl (replace <link> by the URL):

@daronco
daronco / have_attr_accessor.rb
Created Nov 23, 2012
Shoulda matcher have_attr_accessor
View have_attr_accessor.rb
# Ensures the model has an attr_accessor, attr_reader or attr_writer
# Examples:
# it { should have_attr_accessor(:value) }
# it { should have_attr_accessor(:value).read_only }
# it { should have_attr_accessor(:value).write_only }
module Shoulda
module Matchers
module ActiveModel # :nodoc
def have_attr_accessor(attribute)
@daronco
daronco / README
Created Jan 19, 2012
Organize javascripts and stylesheets like views in rails 3.1
View README
Call the helpers 'javascript_include_tags_for_action' and 'stylesheet_link_tags_for_action' in the headers section
of your layout to automatically include javascript and stylesheet files for the current controller and action.
The files are included only if they exist. It is first included the file for all the actions of acontroller (e.g 'events/_all.js')
and then the file for the current action (e.g. 'events/show.js').
You can organize javascripts and stylesheets like views are organized.
Assuming you have the controllers "Events" and "Spaces":
- app/
@daronco
daronco / restart_file_touched.rb
Created Jan 17, 2012 — forked from technicalpickles/restart_file_touched.rb
A custom condition for God that checks for change in a file (usually tmp/restart.txt)
View restart_file_touched.rb
module God
module Conditions
class RestartFileTouched < PollCondition
attr_accessor :restart_file
def initialize
super
end
def process_start_time
Time.parse(`ps -o lstart -p #{self.watch.pid} --no-heading`)
You can’t perform that action at this time.