Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View tsega's full-sized avatar
🏰
Working from home

Tsegaselassie Tadesse tsega

🏰
Working from home
View GitHub Profile
@tsega
tsega / aliases.drushrc.php
Created November 18, 2017 08:19
Drush Alias
<?php
// To be placed at ~/.drush folder
// drush sql-sync @PROJECT.dev @PROJECT.local
// drush rsync @PROJECT.dev:%files/ @PROJECT.local:%files
// local alias
$local_sites = '/var/www/html/';
// development alias
$dev_sites = '/var/www/html/';
@tsega
tsega / docker-compose.yml
Last active October 16, 2017 06:01
docker4drupal edited Docker compose file
# Replace PROJECT_NAME, e.g. amber
version: "2"
services:
mariadb:
image: wodby/mariadb:10.1-2.3.3
environment:
MYSQL_ROOT_PASSWORD: password
MYSQL_DATABASE: PROJECT_NAME
@tsega
tsega / items.json
Created April 2, 2017 04:59
CGSpace REST API Response
[
{
"id": 72092,
"handle": "https://cgspace.cgiar.org/handle/10568/70238",
"thumbnail": "https://cgspace.cgiar.org/bitstream/handle/10568/70238/beca_beanRwanda_poster_feb2016.pdf.jpg",
"metadata": [
{
"value": "SIDA",
"element": "description",
"qualifier": "sponsorship",
@tsega
tsega / routing.js
Created November 23, 2016 06:08
Iron-Router waitOn()
// Wait On one or more subscription before loading the page.
Router.route("/", {
name: "home",
waitOn: function () {
return [
Meteor.subscribe('users'),
// any other subscription to wait on
];
},
action: function () {
@tsega
tsega / summary_comment.html
Created August 18, 2016 06:18
Cattle Genomics Summary Link Comment to copy and paste
<strong>The current topics being discussed are:</strong>
What (real) examples of the application of genomic or genetic information to African livestock
production systems (regardless of species) do we have to-date, and what was successful or not
successful about these, and why. For a summary of information to date please click,
<a href="http://cattle-genomix.net/current-use-of-genomics-genetics-in-african-livestock-systems/">here</a>.
@tsega
tsega / gist:40adc156b5ba008fa0b3afa186a07327
Created June 20, 2016 16:54
CGSpace Connection refused error
Java stacktrace: java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
at java.net.Socket.connect(Socket.java:589)
at org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:117)
at org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:177)
at org.apache.http.impl.conn.ManagedClientConnectionImpl.open(ManagedClientConnectionImpl.java:304)
@tsega
tsega / dspace.log
Created June 16, 2016 21:00
Atmire MQM migration error log
2016-06-16 23:07:04,427 ERROR org.flywaydb.core.internal.command.DbMigrate @ Migration of schema "public" to version 5.1.2015.12.03.3 failed! Changes successfully rolled back.
2016-06-16 23:07:04,431 ERROR org.dspace.storage.rdbms.DatabaseManager @ SQL getDataSource Error -
java.sql.SQLException: Flyway migration error occurred
at org.dspace.storage.rdbms.DatabaseUtils.updateDatabase(DatabaseUtils.java:389)
at org.dspace.storage.rdbms.DatabaseUtils.updateDatabase(DatabaseUtils.java:309)
at org.dspace.storage.rdbms.DatabaseManager.initialize(DatabaseManager.java:1371)
at org.dspace.storage.rdbms.DatabaseManager.getDataSource(DatabaseManager.java:648)
at org.dspace.storage.rdbms.DatabaseManager.getConnection(DatabaseManager.java:627)
at org.dspace.core.Context.init(Context.java:121)
at org.dspace.core.Context.<init>(Context.java:95)
@tsega
tsega / convert_pdf.rb
Last active February 11, 2016 11:08
A ruby command line script to generate jpg's from the first pages of pdf files.
#!/usr/bin/env ruby
# This require that you have ImageMagick and Ghostscript installed and available on your PATH
# It also assumes you have you pdf files in `pdfs` folder
# Note: Since it generates jpg's it does not handle transparency very well
# modify the .jpg to .png to generate png files.
Dir['pdfs/*.pdf'].each do |pdf_file|
jpg_file = pdf_file.chomp(File.extname(pdf_file)) + ".jpg"
system("convert -density 144 #{pdf_file}[0] -resize 200x300 #{jpg_file} ")
@tsega
tsega / mongo_db_date_between.js
Created December 1, 2015 15:40
How query MongoDB for values between dates
items.find({
created_at: {
$gte:"Mon May 30 18:47:00 +0000 2015",
$lt: "Sun May 30 20:40:36 +0000 2010"
}
})
@tsega
tsega / connectionStatus.js
Last active August 29, 2015 14:14
How to add connection id to onClose callback (on the Server side)?
Meteor.onConnection(function(connection){
connection.onClose(function(){
Posts.update({"viewers.sessionId": this.id}, {
$pull: {
viewers: {
sessionId: this.id
}
}