Skip to content

Instantly share code, notes, and snippets.

/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';
@xErik
xErik / atom-tree-view-colored-icons
Created July 20, 2015 13:17
Atom Tree-View with colored icons, color depending on tree level
.tree-view {
background-image: url("");
li.directory {
.header {
.icon:before {
color: #337ab7;
}
}
@xErik
xErik / kali-headless.md
Last active June 20, 2023 20:11
Configuring Headless (no X, GUI) Kali, Running In VirtualBox

Kali Headless Mode Configuration

Disabling the GUI/X/Head

systemctl set-default multi-user.target
systemctl get-default # shows new default mode
reboot
@xErik
xErik / howto.md
Created August 30, 2015 10:54
VirtualBox, Mac OS X, Internet Connection

Windows XP will not automatically connect to the internet. To set up internet connection via Airport:

  1. Shut down VirtualBox and reopen
  2. Navigate to Settings > Network and set these options:
  • Attached to: Bridged Adapter
  • Name: en1: Airport
  • Advanced > Adapter Type: PCnet-Fast 111 (Am79C973). All other settings at default.
  1. Restarting VirtualBox may be necessary.

Get with and height

randomFileW=$(identify -format "%w\n" $randomFile) randomFileH=$(identify -format "%h\n" $randomFile) randomFileName=$(identify -format "%h\i" $randomFile)

Get maximum height and width of images in directory

maxWidth=$(identify -format "%w\n" dir/* | sort -n -r | head -n 1) maxHeight=$(identify -format "%h\n" dir/* | sort -n -r | head -n 1)

Remove single BW pixels in BW image

@xErik
xErik / smarty.tpl
Created September 2, 2016 15:36
Create table with Smarty
<table id="frontpage_categories_new">
<tr>
{$cols=3}
{foreach $module_content as $module_data}
<td style="width:300px;">
<a href="{$module_data.categories_link}">
<img src="{$smarty.const.DIR_WS_IMAGES}categories/{$module_data.categories_image}">
{$module_data.categories_name} | {$smarty.foreach.foo.iteration neq 1 AND $smarty.foreach.foo.iteration is div by 3}
</a>
</td>
// SVG.Text with added functionality of measing the pixel width server side using NODE.
//
// Depends mainly on 'svg.js' and 'string-pixel-width'.
// 'Check string-pixel-width' on npmjs.org for supported fonts.
//
// COMPLETE EXAMPLE
//
// const window = require('svgdom');
// const SVG = require('svg.js')(window);
// const document = window.document;
@xErik
xErik / megemp3.sh
Last active July 29, 2019 12:37
Combine multiple MP3 files from multiple folders into an audiobook
#!/bin/bash
# Requires http://mp3wrap.sourceforge.net/
# Require rename
# Correct sorting for me, NOT: 1, 10, 11, 2 ,...
# Names the MP3 to current directory name
# Replaces whitespace in file and folder names by single underscore
# This script is usefull if your direcorie names are like: VCD_2019_7_26_(1), VCD_2019_7_26_(2), ...
npm install -g @angular/cli
ng new new-project
cd new-project
npm install firebase @angular/fire bootstrap jquery --save
# Set DB: Firestore
# Set public directory: dist/new-project
firebase init
# firebase deploy should trigger a production build.
// ./src/app/functionstest/functionstest.tl
import { Component, OnInit } from '@angular/core';
import { AngularFireFunctions } from '@angular/fire/functions';
@Component({
selector: 'app-functiontest',
template:'<p style="border:1px red solid;margin-top:50px">{{ out }}x</p>'
})
export class FunctiontestComponent implements OnInit {