Skip to content

Instantly share code, notes, and snippets.

View larvanitis's full-sized avatar

Leonidas Arvanitis larvanitis

  • Athens, Greece
View GitHub Profile
@larvanitis
larvanitis / filter_on_mimetype-slimmed.sh
Created November 16, 2012 16:15
BASH::Filter file on mimetype
#!/bin/bash
# make sure the file exists and that it's a regular file before proceeding
[ -z "$1" ] && echo "you must specify a file!" >&2 && exit 1
[ ! -e "$1" ] && echo "$1 doesn't exist!" >&2 && exit 1
[ ! -f "$1" ] && echo "$1 is not a regular file!" >&2 && exit 1
FILE=$1
FILE_MIME=$(file -b --mime-type "$FILE") #or "xdg-mime query filetype"
VALID_MIMETYPES=(
"application/octet-stream" #bmp image
@larvanitis
larvanitis / rtorrentd
Created November 17, 2012 10:31
RTORRENT::Daemon setup / init script
#!/bin/bash
### BEGIN INIT INFO
# Provides: rtorrent
# Required-Start: $network
# Required-Stop: $network
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start rtorrent as a daemon
### END INIT INFO
@larvanitis
larvanitis / Yeoman-ng_gen.xml
Last active December 17, 2015 09:29
Webstorm / IDEA :: External Tools :: Yeoman angular:* generators (w/o --coffee or --minsafe) Installation: drop in ~/.WebStorm6/config/tools/
<?xml version="1.0" encoding="UTF-8"?>
<toolSet name="Yeoman[ng]">
<tool name="Create Route" description="Generates a controller and view, and configures a route in app/scripts/app.js connecting them." showInMainMenu="true" showInEditor="false" showInProject="true" showInSearchPopup="false" disabled="false" useConsole="false" showConsoleOnStdOut="false" showConsoleOnStdErr="true" synchronizeAfterRun="true">
<exec>
<option name="COMMAND" value="yo" />
<option name="PARAMETERS" value="angular:route $Prompt$" />
<option name="WORKING_DIRECTORY" value="$ProjectFileDir$" />
</exec>
</tool>
<tool name="Create Controller" description="Generates a controller in app/scripts/controllers." showInMainMenu="true" showInEditor="false" showInProject="true" showInSearchPopup="false" disabled="false" useConsole="false" showConsoleOnStdOut="false" showConsoleOnStdErr="true" synchronizeAfterRun="true">
@larvanitis
larvanitis / stateChangeDebugging.js
Created June 23, 2015 09:35
Event logging for AngularJS $location and ui-router $state change.
angular.module('myModule').run(function ($rootScope, $state) {
/* ENTRY EVENTS */
$rootScope.$on('$locationChangeStart', function (event, toUrl, fromUrl, toHistoryState, fromHistoryState) {
console.groupCollapsed('$locationChangeStart');
console.debug('event:', event);
console.debug('toUrl:', toUrl);
console.debug('fromUrl:', fromUrl);
console.debug('toHistoryState:', toHistoryState);
# Maintainer: Leonidas Arvanitis <l.arvanitis gmail com>
# Contributor: Marius Nestor <marius softpedia com>
pkgname=musictube
pkgver=1.6
pkgrel=1
pkgdesc="YouTube streaming music player"
arch=('x86_64')
url="http://flavio.tordini.org/musictube"
license=('Proprietary')
@larvanitis
larvanitis / jquery.semantic-ui.d.ts
Created May 21, 2017 16:48
Custom SemanticUI typescript definitions
// tslint:disable:max-file-line-count
declare namespace SemanticUI {
type JQuerySelectorOrElement = string | Element | JQuery;
type AnimationDuration = string | number; // '500ms'
type AnimationName = 'scale' | 'scale in' | 'scale out'
| 'fade' | 'fade up' | 'fade down' | 'fade left' | 'fade right'
| 'fade in' | 'fade up in' | 'fade down in' | 'fade left in' | 'fade right in'
@larvanitis
larvanitis / howto.sh
Last active September 20, 2017 10:00
Encrypted file container
#!/bin/sh
echo "Not a script..." >&2 && exit 1
# This is more or less a TL;DR; procedure to create and use an encrypted volume contained in a file instead of a physical drive/partition.
# The encryption options are set to sane (and IMHO secure) values. The device will be (un)locked using a password.
# The mounting is done manually by the root and all users can access the mounted filesystem.
################
# REQUIREMENTS #
/*
* Maximizes the height of an element, using flex laytout,
* by applying classes to the element and it's parents.
* Warning: It breaks a lot of layouts and it is not a substitute for proper,
* hand-crafted code. Also, it is not really tested!
*/
/** Shorthand for `toggleMaxHeightElem(..., isMaximize = true)` */
function maximizeElemHeight(elem, topParent = 'html') {
toggleMaxHeightElem(elem, topParent, true);
@larvanitis
larvanitis / index.html
Created June 2, 2020 16:05
Quasar Component Outside Vue
<!-- assuming you have placed this outside `dist` dir -->
<html>
<head>
<meta charset="utf-8">
<title>Quasar Component Demo</title>
<link rel="stylesheet" href="./dist/myComponent.css">
</head>
<body>
<div id="my-component-selector"></div>
@larvanitis
larvanitis / component-wrapper.js
Created June 2, 2020 16:19
Quasar Component Wrapper
import Vue from 'vue';
import {quasarInit} from './quasar';
// props are required if you want to be able to do `vm.$data.myProp = 'xyz'` later
export function createComponent(component, elementOrSelector, props = {}) {
const el = resolveElement(elementOrSelector);
let origHtml = el.innerHTML;
Vue.config.productionTip = false;
quasarInit();