Skip to content

Instantly share code, notes, and snippets.

View Strae's full-sized avatar
🎯
Focusing

Daniele P. Strae

🎯
Focusing
View GitHub Profile
@Strae
Strae / moodle.conf
Created December 15, 2016 09:01
Moodle 3.1 Nginx configuration
server {
listen 80;
server_name [SERVERNAME];
root [HTROOT-PATH];
index index.php index.html index.htm;
location / {
# First attempt to serve request as file
try_files $uri $uri/index.php;
}
@Strae
Strae / xfdf.php
Created January 20, 2017 10:18 — forked from collegeman/xfdf.php
Generate xFDF in PHP
<?php
/*
KOIVI HTML Form to FDF Parser for PHP (C) 2004 Justin Koivisto
Version 1.1
Last Modified: 2010-02-17
This library is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or (at
your option) any later version.
@Strae
Strae / terminator-random-profile.sh
Created May 5, 2017 09:59
Terminator random profile
#!/bin/bash
# Profiles must be named profile1, profile2, etc..
N=$(( ( RANDOM % 12 ) + 1 ));
terminator -p profile$N -T $N &
@Strae
Strae / Paginator.vue
Created May 29, 2017 08:18
Dead simple Vuejs paginator component
<template>
<nav v-if="0 < numResults" class="float pagination" aria-label="Page navigation">
<ul class="pagination">
<li v-if="show_prev">
<a href="#" class="no-underline" aria-label="First" v-on:click="first()">
<span aria-hidden="true">[1]</span>
</a>
</li>
<li v-if="show_prev">
<a href="#" class="no-underline" aria-label="Previous" v-on:click="prev()">
@Strae
Strae / .bash_aliases
Last active September 28, 2017 15:14
Bash aliases tools
# best-alias-EVER
alias Grep="grep"
# show file/folders permissions on octal (e.g. 777) mode.
alias lso="ls -ahlG | awk '{k=0;for(i=0;i<=8;i++)k+=((substr(\$1,i+2,1)~/[rwx]/)*2^(8-i));if(k)printf(\" %0o \",k);print}'"
# just shorthand.
alias nhost="sudo nano /etc/hosts"
# notify that something just happended.
# usefull for commands that require long time - e.g. mysqldump -u XXXXXXX && alert
alias alert="notify-send 'SOMETHING HAPPENED!' -u critical -i /home/dp/.icons/Numix-Circle/scalable/apps/popcorntime.svg"
# keep a debian machine updated. tbh, dunno if really usefull.
@Strae
Strae / conky.conf
Created June 8, 2017 08:57
Conky simple vertical bars
alignment top_left
background no
border_width 0
default_color white
default_outline_color white
double_buffer yes
draw_borders no
draw_outline no
draw_shades yes
use_xft yes
@Strae
Strae / .local__share__applications__menulibre-terminal.desktop
Last active July 19, 2017 13:16
Random terminator proifile (max 12)
[Desktop Entry]
Version=1.0
Type=Application
Name=Terminal
Icon=Terminal
Exec=PATH_OF_FILE_t.sh
NoDisplay=false
Categories=System;
StartupNotify=false
Terminal=false
@Strae
Strae / module.module
Created June 22, 2017 08:04
Drupal 7 embed view with filters
$view = views_get_view('glossario');
$view->dom_id = hash( 'md5', microtime( true ) . mt_rand() );
$view->set_display('search_results');
$view->is_cacheable = FALSE;
$view->exposed_input['title'] = $_GET['term'];
return $view->render();
@Strae
Strae / aframe-obj-opacity.md
Last active April 22, 2020 09:23
Aframe opacity on 3D objects

@source: https://stackoverflow.com/questions/43914818/alpha-animation-in-aframe-for-a-object-model

The built-in material component primarily works with primitives, so material="opacity: 0.5" and similarly opacity="0.5" will not work here. You'll need to modify the THREE.js materials created by your model, using a custom component. Example:

AFRAME.registerComponent('model-opacity', {
  schema: {default: 1.0},
  init: function () {
    this.el.addEventListener('model-loaded', this.update.bind(this));
  },
@Strae
Strae / _text.js
Created September 21, 2017 10:52
Aframe zoom control test
AFRAME.registerComponent( 'cth-zoom', {
schema: {
to: { type: 'string' }
},
init: function () {
var data = this.data;
var el = this.el;
var cameraEl = document.getElementById( 'cth-camera' );
el.addEventListener( 'click', function () {
var _camera = cameraEl.getAttribute( 'camera' );