Eikonal Blog

2010.07.28

Security tools

2011.02.28: This post was getting too large, so I broke it into smaller pieces:


There are still some smaller islands of content that do not yet deserve separate postings:

Patch Management

  • GFI Languard
  • NSS
  • Lumension
  • EndPoint

Sites:

IT Management

Datamining / logs management

Password analysis

Various collections

Misc


Sources:


See also local info at this blog:

Version control systems

Filed under: tools — Tags: , , , , — sandokan65 @ 10:25

2010.07.22

Scripting user interfaces

Filed under: web tools — Tags: , , , , , — sandokan65 @ 13:32

Browser scripting:

Volume of the ball

Filed under: geometry — Tags: , — sandokan65 @ 13:12
  • The “volume” \Omega_n :\equiv \hbox{Vol}(B^n) of the ball B^n :\equiv \{x \in {\Bbb R}^n | s/t |x|<1\} is given by \Omega_n = \frac{\pi^{n/2}}{\Gamma(1+\frac{n}2)}.
  • The “surface area” \omega_n :\equiv \hbox{Area}({\Bbb S}^{n-1}) of the sphere {\Bbb S}^{n-1} :\equiv \{x \in {\Bbb R}^n | s/t |x|=1\} = \partial B^n is given by \omega_n = (n+1) \Omega_{n+1}.

Note: \Omega_{n+2} = \frac{\pi}{n+1}\Omega_n, so: \Omega_{2n} = \frac{\pi^n}{(2n-1)!!} and \Omega_{2n+1} = \frac{8 \pi^n}{3(2n)!!}.

Examples:
\begin{array}{ | c | c | c | c | c | c | c | c |} \hline n & 2 & 3 & 4 & 5 & 6 & 7 & 8 \\  \hline \Omega_n &  \pi & \frac{4\pi}{3} & \frac{\pi^2}2 & \frac{\pi^2}3 & \frac{\pi^3}{10} & \frac{\pi^3}{18} & \frac{\pi^4}{70} \\ \hline \omega_{n-1} & 2\pi & 4\pi & 2\pi^2 & \frac{5\pi^2}{3} & \frac{3\pi^3}5 & \frac{7\pi^3}{18} & \frac{4\pi^4}{35} \\   \hline \end{array}

Alzer’s inequalities (as cited in [1]):

  • a \Omega_{n+1}^{\frac{n}{n+1}} \le \Omega_n \le b \Omega_{n+1}^{\frac{n}{n+1}}, where a=\frac{2}{\sqrt{2}} = 1.128,37\cdots, b=\sqrt{e}=1.648,72\cdots;
  • \sqrt{\frac{n+A}{2\pi}} \le \frac{\Omega_{n-1}}{\Omega_n} \le \sqrt{\frac{n+B}{2\pi}}, where A=\frac12 and B=\frac\pi2-1=0.570,79\cdots;
  • \left(1+\frac1{n}\right)^\alpha \le \frac{\Omega_n^2}{\Omega_{n-1}\Omega_{n+1}} \le \left(1+\frac1{n}\right)^\beta, where \alpha=2-\frac{\ln(\pi)}{\ln(2)} = 0.348,50\cdots and \beta=\frac12.

Sources:

  1. [1] “Topics in Special Functions” by G. D. Anderson, M. K. Vamanamurthy, M. Vuorinen – http://arxiv.org/abs/0712.3856

Library of metrics

Filed under: General relativity, geometry — Tags: , , — sandokan65 @ 09:42

ADM decomposition

In D=1+3 dimensions the ADM (Arnowitt-Deser-Misner) split of the metric is given by (i,j\in\overline{1,3}, \mu,\nu\in\overline{0,3}):

ds^2  = -N^2 dt^2 + g_{ij}^{(3)}(dx^i+N^i dt)(dx^j+N^j dt)
where N is the lapse variable, N^i is the shift 3-vector.

Here:

  • R = K_{ij}K^{ij} - K^2 + R^{(3)} + 2\nabla_\mu (n^\mu \nabla_\nu n^\nu - n^\nu \nabla_\nu n^\mu) is the Ricci scalar,
  • K_{ij} :\equiv \frac1{2N} (\dot{g}_{ij}^{(3)} - \nabla_i^{(3)} N_j - \nabla_j^{(3)} N_i) is the extrinsic curvature, K :\equiv g^{ij}K_{ij}.

Source: “Unifying inflation with dark energy in modified F(R) Horava-Lifshitz gravity” by E. Elizalde, S. Nojiri, S. D. Odintsov, D. Saez-Gomez; arXiv.org > hep-th > arXiv:1006.3387 (http://arxiv4.library.cornell.edu/abs/1006.3387).

More:

2010.07.20

Vector bases for 3D kinematics

Filed under: mathematics — Tags: — sandokan65 @ 16:02

Relevant sets of basis vectors

There are four relevant sets of orthonormal basis vectors (=triads) here:

  • {\cal B}_1 :\equiv \{\underline{e}_x,\underline{e}_y,\underline{e}_x\} – orts corresponding to the Cartesian coordinates \{x,y,z\},
  • {\cal B}_3 :\equiv \{\underline{n},\underline{p},\underline{q}\}, defined by:
    • \underline{n} :\equiv \frac1{r}\underline{r} = (\cos(\theta)\cos(\varphi),\cos(\theta)\sin(\varphi),\sin(\theta)) ,
    • \underline{p} :\equiv \frac{\partial}{\partial \theta} \underline{n} = (-\sin(\theta)\cos(\varphi),-\sin(\theta)\sin(\phi),\cos(\theta)),
    • \underline{q} :\equiv \frac1{\cos(\theta)}\frac{\partial}{\partial \varphi} \underline{n} = (-\sin(\varphi),\cos(\phi),0),

    Note that here: \underline{n}\times\underline{p} = - \underline{q}, ie. that this basis is left-handed.

  • {\cal B}_3 :\equiv \{\underline{n},\underline{m},\underline{k}\} – radius-based basis, defined by:
    • \underline{n} :\equiv \frac1{r}\underline{r},
    • \underline{m} :\equiv \hbox{Normalized}(\underline{n}'),
    • \underline{k} :\equiv \underline{n}\times\underline{m}.
  • {\cal B}_4 :\equiv \{\underline{T},\underline{O},\underline{B}\} – tangent-based basis (“frame”), defined by:
    • \underline{T} :\equiv \hbox{Normalized}(\underline{r}') = \frac1{v}\underline{v} = \frac{r'}{v} \underline{n} + \frac{r \Phi'}{v} \underline{m},
    • \underline{N} :\equiv \hbox{Normalized}(\underline{T}')
    • \underline{B} :\equiv \underline{T}\times\underline{N}.

    where \underline{v} :\equiv \underline{r}' = r' \underline{n} + r \Phi' \underline{m} and v(t) = \sqrt{r'^2+r^2\Phi'^2}.
    Note that \underline{N} \ne \underline{n}.

Triad kinematic formulas

{\cal B}_2:

  • \underline{n}' = \theta' \underline{p} + \cos(\theta)\varphi' \underline{q},
  • \underline{p}' = -\theta' \underline{n} - \sin(\theta)\varphi' \underline{q},
  • \underline{q}' = -\cos(\theta) \theta' \underline{n} + \sin(\theta)\varphi' \underline{p}.

{\cal B}_3:

  • \underline{n}' = \Phi' \underline{m},
  • \underline{m}' = -\Phi' \underline{n} + \Theta' \underline{k},
  • \underline{k}' = -\Theta' \underline{m}.

Note that \Phi and \Theta are not the same as \varphi and \theta. They are defined by these equations.

A vector \underline{A} = A_n\underline{n}+A_m\underline{m}+A_k\underline{k} evolves according to:
\underline{A}' = [A'_n - \Phi' A_m]\underline{n} + [A'_m + \Phi' A_n - \Theta' A_k]\underline{m} + [A'_k + \Theta' A_m]\underline{k}.

{\cal B}_4 is guided by the Frenet–Serret formulas:

  • \frac{d}{ds}\underline{T} = \kappa \underline{N},
  • \frac{d}{ds}\underline{N} = -\kappa  \underline{T} + \tau \underline{B},
  • \frac{d}{ds}\underline{B} = -\tau \underline{N}.

where s(t) :\equiv \int_0^t dt' v(t').

Relations between triads

{\cal B}_3 in terms of {\cal B}_2:

  • \underline{n} =  \underline{n},
  • \underline{p} = \frac{\theta'}{\Phi'} \underline{m} + \cos(\theta)\frac{\varphi'}{\Phi'} \underline{k},
  • \underline{q} = \cos(\theta) \frac{\varphi'}{\Phi'} \underline{m} - \frac{\theta'}{\Phi'} \underline{k}.

{\cal B}_2 in terms of {\cal B}_3:

  • \underline{n} =  \underline{n},
  • \underline{m} = \frac{\theta'}{\Phi'} \underline{p} + \cos(\theta)\frac{\varphi'}{\Phi'} \underline{q},
  • \underline{k} = \cos(\theta) \frac{\varphi'}{\Phi'} \underline{p} - \frac{\theta'}{\Phi'} \underline{q}.

Note: Here

  • \Phi'^2 :\equiv \theta'^2 + \cos(\theta)^2 \varphi'^2,
  • \Theta' :\equiv \sin(\theta) \varphi'  \left(1+\frac{\theta'^2}{\Phi'^2}\right) + \cos(\theta) \frac{\theta''\varphi'-\theta'\varphi''}{\Phi'^2}.

Note: if we replace t with \Phi, then

  • \left(\frac{d\theta}{d\Phi}\right)^2 + \cos(\theta)^2 \left(\frac{d\varphi}{d\Phi}\right)^2=1,
  • \frac{d\Theta}{d\Phi} = \sin(\theta) \left(\frac{d\varphi}{d\Phi}\right)  \left[1+\left(\frac{d\theta}{d\Phi}\right)^2\right] + \cos(\theta) \left[\frac{d^2\theta}{d\Phi^2}\frac{d\varphi}{d\Phi}-\frac{d\theta}{d\Phi}\frac{d^2\varphi}{d\Phi'^2}\right].

Related:

Conservative motion of a 3D particle in potential-like force fields

Filed under: Uncategorized — Tags: , — sandokan65 @ 09:20

Let’s consider the right-hand oriented orthonormal triad {\cal B} :\equiv \{\underline{n},\underline{m},\underline{k}\} (\underline{n}\cdot\underline{m}= \underline{n}\cdot\underline{k} = \underline{m}\cdot\underline{k}= 0 and \underline{n}^2 = \underline{m}^2 = \underline{k}^2 = 1) assigned to a curve c in 3-dimensional Euclidean space {\Bbb R}^3. Let this curve be parametrized by the “time” parameter t associated to the “current” position \underline{r}(t) of a particle moving along that curve. Instead of defining the triad {\cal T} as a tangential vectors (i.e. the tangential, normal and bi-normal vectors) to the c at \underline{r}, define it based on the radius vector \underline{r} by \underline{r} \equiv: \underline{n} r.

The triad vectors satisfy following evolution equations:

  • \underline{n}' \equiv: \varphi' \underline{m},
  • \underline{m}' \equiv: - \varphi' \underline{n} + \theta' \underline{k},
  • \underline{k}' = -\theta' \underline{m},

where \phi(t) and \theta(t) are two angles defining the position of the particle.

In following we will look at the several choices for the force field \underline{F} that guides the motion of the particle via Newton’s equation \underline{r}'' = \underline{F}(\underline{r}, \underline{r}').

The simplest case

For \underline{r}'' = f(r) \underline{r} one finds:

  • r'' = f(r) r + \frac{l^2}{r^3} (radial equation of motion),
  • r^2\phi' = l (= const|_{t}) (preservation of angular momentum),
  • \theta' \equiv 0 (i.e. the trajectory is planar).

A simple generalization

In force field \underline{F} = f(r) \underline{r} + g(r) \underline{r}' one finds:

  • r'' = f(r) r + g(r) r' + r \varphi'^2 (radial equation of motion),
  • l(t) :\equiv r^2\phi' (definition of non-constant angular momentum),
  • l' = g(r) l (equation guiding the evolution of the angular momentum),
  • \theta' \equiv 0, i.e. the trajectory is (still) planar.

This system can be somehow simplified by use of \varphi instead of t, and by introduction of the Binet variable u(\varphi) :\equiv \frac1{r(t)}:

  • - \frac{d^2 u}{d\varphi^2} = u +  \frac{f[u]}{l^2 u^3}
  • \frac{d l}{d\varphi} = \frac{g[u]}{u^2}.

with f[u] :\equiv f(r), g[u] :\equiv g(r), \frac{d}{dt} = l u^2 \frac{d}{d\varphi}, r'(t) = - l \frac{d u}{d\varphi} and r''(t) = - l u^2 \frac{d}{d\varphi}\left(l \frac{d u}{d\varphi}\right).

Further generalization

For \underline{r}'' = f(r) \underline{r} + g(r) \underline{r}' + h(r) \underline{r}\times\underline{r}' we get:

  • r'' = f r + g r' + r \varphi'^2,
  • l :\equiv r^2 \varphi',
  • l' = g(r) l,
  • \theta' = h(r) r – the trajectory is not planar any more.

which, in Binet coordinates has following form

  • - \frac{d^2 u}{d\varphi^2} = u +  \frac{f[u]}{l^2 u^3}
  • \frac{d l}{d\varphi} = \frac{g[u]}{u^2}.
  • \frac{d \theta}{d\varphi} = \frac{h[u]}{l u^3}.

2010.07.19

Windows command line shortcuts

Filed under: windows — Tags: — sandokan65 @ 23:42
  • Default registry editor: regedit
  • Windows Installer:
    • Correcting the occasional problem with registration of MSI file type:
      • 1) first run: msiexec /unregister;
      • 2) then run: msiexec /regserver
    • Correcting the situation where the Windows Installer does not run properly but refuses to reinstall (source: http://support.microsoft.com/default.aspx?scid=KB;EN-US;319624):

      Method 5: Fix the broken security key for the MsiServer service

      • 1. Start the computer by using Windows 2000.
      • 2. Click Start, click Run, type regedit.exe, and then rename the following key to Old_Security:
        HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MSIServer\Security
      • 3.. Restart the computer (you must do this).
      • 4. Run Instmsiw.exe for installer 2.0 again; this corrects the broken security key for the MSI service.

    • Installing a MSI file using the command line version of Windows installer: msiexec /i python-2.6.5.msi
  • Accessing the Services applet: services.msc
  • Killing multiple instances of a process: taskkill /IM “outlook.exe” /f (Source: http://anigan.wordpress.com/2008/03/26/using-taskkill-to-kill-muliple-instances-of-outlookexe/)
  • Windows protected file cheker: sfc

2010.07.16

Paywalls

Filed under: opression, paywalls — Tags: — sandokan65 @ 12:27
  • Murdoch’s UK Paywall a Miserable Failure (SlashDot; 2010.07.16) – http://news.slashdot.org/article.pl?sid=10/07/16/027236
      “As part of his war against free, Rupert Murdoch put the Times and Sunday Times of London behind a paywall. Michael Wolff of Newser asks how that’s working out for him. You can guess: miserable failure: ‘Not only is nobody subscribing to the website, but subscribers to the paper itself — who have free access to the site — are not going beyond the registration page. It’s an empty world.’ Not that this wasn’t entirely predictable.”
  • What’s Really Going on Behind Murdoch’s Paywall? by Michael Wolf (newser; 2010.07.14) – http://www.newser.com/off-the-grid/post/502/whats-really-going-on-behind-murdochs-paywall.html
  • The Times Erects a Paywall, Plays Double Or Quits (SlashDot; 2010.03.27) – http://news.slashdot.org/story/10/03/27/0356211/The-Times-Erects-a-Paywall-Plays-Double-Or-Quits
      “News International, owners of The Times and The Sunday Times announced today that from June readers will be required to pay £1 per day or £2 per week to access content. Rupert Murdoch is delivering on his threat to make readers pay, and is trying out this experiment with the most important titles in his portfolio. No one knows if this will work — there is no consensus on whether it is a good or bad thing for the industry, but be very clear that if it succeeds every one of his competitors will follow. Murdoch has the luxury of a deep and wide business, so he can push this harder than any company that has to rely upon one or two titles for revenue.”
  • Newsday Gets 35 Subscriptions To Pay Web Site (SlashDot; 2010.01.27) – http://news.slashdot.org/story/10/01/27/1345219/Newsday-Gets-35-Subscriptions-To-Pay-Web-Site
      “In late October, Newsday put its web site behind a pay wall, one of the first non-business newspapers to take the pay wall plunge, so Newsday has been followed with interest in media circles anxious to learn how the NY Times own plans to put up a pay wall may work out. So how successful has Newsday’s paywall been? The NY Observer reports that three months into the experiment only 35 people have signed up to pay $5 a week to get unfettered access to newsday.com. Newsday’s web site redesign and relaunch reportedly cost about $4 million and the 35 people who’ve signed up have earned Newsday about $9,000. Still publisher Terry Jimenez is unapologetic. ‘That’s 35 more than I would have thought it would have been,’ said Jimenez to his assembled staff, according to five interviews with Newsday employees. The web project has not been a favorite among Newsday employees who have recently been asked to take a 10 percent pay cut. ‘The view of the newsroom is the web site sucks,’ says one staffer. ‘It’s an abomination,’ adds another.”

ACTA

Filed under: ACTA, opression, surveillance — Tags: , , , , — sandokan65 @ 12:17

Related here: Law vs Technology – https://eikonal.wordpress.com/2012/05/16/law-vs-technology/

| Information disclosure sites – https://eikonal.wordpress.com/2010/02/25/information-disclosure-sites/ | WikiLeaks 2010 – https://eikonal.wordpress.com/2010/12/29/wikileaks-2010/

2010.07.14

Javascript Password Strength Meter

Filed under: passwords — Tags: , — sandokan65 @ 13:03

http://www.geekwisdom.com/dyn/passwdmeter

Code (http://www.geekwisdom.com/js/passwordmeter.js):

/* ************************************************************
Created: 20060120
Author:  Steve Moitozo  -- geekwisdom.com
Description: This is a quick and dirty password quality meter 
		 written in JavaScript so that the password does 
		 not pass over the network.
License: MIT License (see below)
Modified: 20060620 - added MIT License
Modified: 20061111 - corrected regex for letters and numbers
                     Thanks to Zack Smith -- zacksmithdesign.com
---------------------------------------------------------------
Copyright (c) 2006 Steve Moitozo 

Permission is hereby granted, free of charge, to any person 
obtaining a copy of this software and associated documentation 
files (the "Software"), to deal in the Software without 
restriction, including without limitation the rights to use, 
copy, modify, merge, publish, distribute, sublicense, and/or 
sell copies of the Software, and to permit persons to whom the 
Software is furnished to do so, subject to the following 
conditions:

   The above copyright notice and this permission notice shall 
be included in all copies or substantial portions of the 
Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 
KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 
WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE 
AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT 
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE 
OR OTHER DEALINGS IN THE SOFTWARE. 
---------------------------------------------------------------


Password Strength Factors and Weightings

password length:
level 0 (3 point): less than 4 characters
level 1 (6 points): between 5 and 7 characters
level 2 (12 points): between 8 and 15 characters
level 3 (18 points): 16 or more characters

letters:
level 0 (0 points): no letters
level 1 (5 points): all letters are lower case
level 2 (7 points): letters are mixed case

numbers:
level 0 (0 points): no numbers exist
level 1 (5 points): one number exists
level 1 (7 points): 3 or more numbers exists

special characters:
level 0 (0 points): no special characters
level 1 (5 points): one special character exists
level 2 (10 points): more than one special character exists

combinatons:
level 0 (1 points): letters and numbers exist
level 1 (1 points): mixed case letters
level 1 (2 points): letters, numbers and special characters 
					exist
level 1 (2 points): mixed case letters, numbers and special 
					characters exist


NOTE: Because I suck at regex the code might need work
	  
NOTE: Instead of putting out all the logging information,
	  the score, and the verdict it would be nicer to stretch
	  a graphic as a method of presenting a visual strength
	  guage.

************************************************************ */
function testPassword(passwd)
{
		var intScore   = 0
		var strVerdict = "weak"
		var strLog     = ""
		
		// PASSWORD LENGTH
		if (passwd.length4 && passwd.length7 && passwd.length15)                    // length 16 or more
		{
			intScore = (intScore+18)
			strLog   = strLog + "18 point for length (" + passwd.length + ")\n"
		}
		
		
		// LETTERS (Not exactly implemented as dictacted above because of my limited understanding of Regex)
		if (passwd.match(/[a-z]/))                              // [verified] at least one lower case letter
		{
			intScore = (intScore+1)
			strLog   = strLog + "1 point for at least one lower case char\n"
		}
		
		if (passwd.match(/[A-Z]/))                              // [verified] at least one upper case letter
		{
			intScore = (intScore+5)
			strLog   = strLog + "5 points for at least one upper case char\n"
		}
		
		// NUMBERS
		if (passwd.match(/\d+/))                                 // [verified] at least one number
		{
			intScore = (intScore+5)
			strLog   = strLog + "5 points for at least one number\n"
		}
		
		if (passwd.match(/(.*[0-9].*[0-9].*[0-9])/))             // [verified] at least three numbers
		{
			intScore = (intScore+5)
			strLog   = strLog + "5 points for at least three numbers\n"
		}
		
		
		// SPECIAL CHAR
		if (passwd.match(/.[!,@,#,$,%,^,&,*,?,_,~]/))            // [verified] at least one special character
		{
			intScore = (intScore+5)
			strLog   = strLog + "5 points for at least one special char\n"
		}
		
									 // [verified] at least two special characters
		if (passwd.match(/(.*[!,@,#,$,%,^,&,*,?,_,~].*[!,@,#,$,%,^,&,*,?,_,~])/))
		{
			intScore = (intScore+5)
			strLog   = strLog + "5 points for at least two special chars\n"
		}
	
		
		// COMBOS
		if (passwd.match(/([a-z].*[A-Z])|([A-Z].*[a-z])/))        // [verified] both upper and lower case
		{
			intScore = (intScore+2)
			strLog   = strLog + "2 combo points for upper and lower letters\n"
		}

		if (passwd.match(/([a-zA-Z])/) && passwd.match(/([0-9])/)) // [verified] both letters and numbers
		{
			intScore = (intScore+2)
			strLog   = strLog + "2 combo points for letters and numbers\n"
		}
 
									// [verified] letters, numbers, and special characters
		if (passwd.match(/([a-zA-Z0-9].*[!,@,#,$,%,^,&,*,?,_,~])|([!,@,#,$,%,^,&,*,?,_,~].*[a-zA-Z0-9])/))
		{
			intScore = (intScore+2)
			strLog   = strLog + "2 combo points for letters, numbers and special chars\n"
		}
	
	
		if(intScore  15 && intScore  24 && intScore  34 && intScore < 45)
		{
		   strVerdict = "strong"
		}
		else
		{
		   strVerdict = "stronger"
		}
	
	document.forms.passwordForm.score.value = (intScore)
	document.forms.passwordForm.verdict.value = (strVerdict)
	document.forms.passwordForm.matchlog.value = (strLog)
	
}

2010.07.13

TeX and LaTeX links

Filed under: TeX — Tags: , , , , , , , , , , — sandokan65 @ 16:03

Tools


(to be a) Cheatsheet

Lists

    \begin{list}{label code}{body code}
    \item Item one
    \item Item two
    \item Item three
    \end{list}
    

Example:

    \begin{list}{*}{}
    \item Item one
    \item Item two
    \item Item three
    \end{list}
    

Error: “extra alignment tab has been changed to \cr” in pmatrix environment

Trying to compile the matrix with 16 columns:

    $$
    \begin{pmatrix}
    1&0&0&0& 0&0&0&0& 0&1&0&0& 0&0&0&0 \\
    0&0&0&0& 1&0&0&0& 0&0&0&0& 0&1&0&0 \\
    0&0&1&0& 0&0&0&0& 0&0&0&1& 0&0&0&0 \\
    0&0&0&0& 0&0&1&0& 0&0&0&0& 0&0&0&1
    \end{pmatrix}
    $$
    

produced following error:

    ./document.tex:750: Extra alignment tab has been changed to \cr.
     \endtemplate
    
    l.750 1&0&0&0& 0&0&0&0& 0&1&
                                0&0& 0&0&0&0 \\
    

It appears that LaTeX has some internal limitation on default maximal number of columns. This can be changed (accoring to http://newsgroups.derkeiler.com/Archive/Comp/comp.text.tex/2006-06/msg01298.html) by setting

    \setcounter{MaxMatrixCols}{16}
    

in the preamble of the document.

Diferentiating primes

Filed under: mathematics — Tags: , — sandokan65 @ 15:50

Source:

  • How to Differentiate a Number; by Victor Ufnarovski and Bo Ahlander; Journal of Integer Sequences, Vol 6 (2003), Article 0334
  • T24661

Definition: On the set of integer numbers {\Bbb N}_0=\{0,1,2,\cdots\} introduce following unary operation:

  • 0' = 0,
  • 1' = 0,
  • p' = 1, \ \ \ (\forall p \in {\Bbb P}),
  • (ab)' = a'b+a b' \ \ \ \ (\forall a, b \in {\Bbb N}) \ \ (\hbox{Leibnitz rule}).

Examples:
\begin{tabular}{ | c | c c c c c c c c c c c c c c c c c c |} \hline n & 1 & 2 & 3 & 4 & 5 & 6 & 7 & 8 & 9 & 10 & 11 & 12 & 13 & 14 & 15 & 16 & 17 & 18 \\ \hline  n' & 0 & 1 & 1 & 4 & 1 & 5 & 1 & 12 & 6 & 7 & 1 & 16 & 1 & 9 & 8 & 32 & 1 & 81 \\ \hline n'' & 0 & 0 & 0 & 4 & 0 & 1 & 0 & 16 & 5 & 1 & 0 & 32 & 0 & 6 & 12 & 80 & 0 & 10 \\ \hline n''' & 0 & 0 & 0 & 4 & 0 & 0 & 0 & 32 & 1 & 0 & 0 & 80 & 0 & 5 & 16 & 176 & 0 & 7 \\  \hline n'''' & 0 & 0 & 0 & 4 & 0 & 0 & 0 & 80 & 0 & 0 & 0 & 176 & 0 & 0 & 32 & 368 & 0 & 0 \\ \hline \end{tabular}

Note:

  • (a+b)' \ne a' + b',
  • (a b)'' \ne a''b+2a'b'+a b''.

Examples:

  • (2k)'  = k + 2 k' \ge 2k',
  • (3k)' = k+3k' \ge 3k',
  • (4k)' = 4k + 4k' \ge 4k',
  • (5k)' = k + 5k' \le (2k)' + (3k)'.

Note: The only pairs (a,b) s/t a\le b \le 100 with gcd(a,b)=1 and (a+b)'=a'+b' are:
\{(1,2), (4,35), (4, 91), (8, 85), (11,11), (18, 67), (26,29), (27, 55), (35, 55), (36, 81), (38, 47), (38, 83), (50, 79), (62, 83), (95,99)\}.

Theorem: n'\ge n \Rightarrow (kn)' \ge kn, \ \ \ \ (\forall k > 1).

Theorem: If n = \prod_{i=1}^k {p_i}^{n_i} then n' = n \sum_{i=1}^{k} \frac{n_i}{p_i}.

Theorem: For n = m p^p, (p\in {\Bbb P}, m> 1, \in {\Bbb N})

  • n' = p^p (m+m'),
  • \lim_{k\rightarrow \infty} n^{(k)} = \infty.

Extensions:

One can extend the differentiation operation to wider sets of numbers. For example, by setting $(-1)’=0$ one gets extension to the whole set of integer numbers {\Bbb Z}:

  • (-1)' = 0, ,
  • (-p)' = -1, \ \ \ (\forall p \in {\Bbb P}),
  • (-x)' = - x', \ \ \ (\forall x \in {\Bbb Z}).

One can also infer that:

  • i' = 0,
  • \omega' = 0, \ \ \ (\forall \omega^m = 1, \ \ m\in {\Bbb N}),
  • \omega' = 0, \ \ \ (\forall \omega^\alpha = 1, \ \ \alpha\in {\Bbb C}\ \{0\}).
  • \left(\sqrt{p}\right)' = \frac{\sqrt{p}}{2p},
  • \left(\frac1{p}\right)' = -\frac{1}{p^2},
  • \left(p^\alpha\right)' = -\alpha p^{\alpha-1},
  • \ln(p)' = \frac1{p},
  • \left(\frac{n}{m}\right)' = \frac{n'm- n m'}{m^2}.

Definition:

  • \pi(n) :\equiv \ (\# \ of \ p \le n),
  • \pi_1(n) :\equiv \pi(n) - \pi(n-1).

Lemma:

  • \pi_1(n) = 1 if n=p,
  • \pi_1(n) = 0 if n\ne p.

Lemma:

  • \pi_1(n) = 1 \Leftrightarrow  n'=1,
  • \pi_1(n) = 0 \Leftrightarrow n'\ne 1.

Stages of checking password crackability

  1. Check if password is empty.
  2. Check if password is equal to the username.
  3. For system (or application) provided accounts, use the Google to find default passwords provided by manufacturers’, and test them against these accounts on your system(s).
  4. Check if password is in the custom assembled corporate dictionary.
  5. Check if password is in the selected language’s dictionary. (see: https://eikonal.wordpress.com/2010/03/29/default-passwords/)
  6. Check if password is a dictionary word + one digit.
  7. Check if password is an 311tized word.
  8. Is password the concatenation of multiple words.
  9. Check in the database of precomputed password hashes.
  10. Desperate measure: brute force cracking.

Time inversion

Filed under: qft — Tags: , , — sandokan65 @ 14:02

Time inversion

  • {\cal T} = {\cal U}{\cal K}
  • \hat{x}:\equiv (-x^0,\vec{x}) = -\bar{x}
  • {\cal T}H{\cal T}^{-1} = H
  • {\cal T}{\cal L}(x){\cal T}^{-1} = {\cal L}(\hat{x})
  • {\cal T}j_\mu(x){\cal T}^{-1} = j^\mu(\hat{x})

Scalar field – real

  • {\cal T}\phi(x){\cal T}^{-1} = \epsilon\phi(\hat{x})
  • {\cal T}a(\vec{k}){\cal T}^{-1} = \epsilon a(-\vec{k})
  • {\cal T}a^\dagger(\vec{k}){\cal T}^{-1} = \epsilon a^\dagger(-\vec{k})
  • {\cal U}a(\vec{k}){\cal U}^{-1} = \epsilon a^\dagger(-\vec{k})
  • {\cal U}a^\dagger(\vec{k}){\cal U}^{-1} = \epsilon a(-\vec{k})

where \epsilon=\pm 1.

So:
{\cal U} = e^{-\frac{i\pi}2 \int d^3\vec{k} (a^\dagger(\vec{k})a(\vec{k}) - \epsilon a^\dagger(\vec{k})a(-\vec{k}))}.

Scalar field – complex

{\cal T}\phi(x){\cal T}^{-1} = \epsilon\phi^{*}(\hat{x})

Dirac field

Here:

  • {\cal T}\psi(x){\cal T}^{-1} = T \psi(\hat{x})
  • {\cal T}\bar{\psi}(x){\cal T}^{-1} = \bar{\psi}(\hat{x}) \gamma^0 T^\dagger \gamma^0,

where

  • T :\equiv i\gamma^1 \gamma^3 = T^\dagger = T^{-1} = - T^{*},
  • T \gamma_\mu T^{-1} = \gamma_\mu^T = \gamma^{\mu \ *}.

Then

  • T u(p,s) = u^*(-p,-s)e^{i\alpha_+(p,s)},
  • T v(p,s) = v^*(-p,-s)e^{i\alpha_-(p,s)},

\ni where \alpha_\pm(p,s) = \pi + \alpha_\pm(-p,-s).

Now

  • {\cal U} b(p,s) {\cal U}^{-1} = -b(-p,-s) e^{i\alpha_+(p,s)},
  • {\cal U} d^\dagger(p,s) {\cal U}^{-1} = -d^\dagger(-p,-s) e^{i\alpha_-(p,s)}.

Split {\cal U} =  {\cal U}_1{\cal U}_2 s/t

  • {\cal U}_1 b(p,s) {\cal U}_1^{-1} = e^{i\alpha_+(p,s)} b(p,s),
  • {\cal U}_1 d^\dagger(p,s) {\cal U}_1^{-1} = e^{i\alpha_-(p,s)} d^\dagger(p,s),
  • {\cal U}_2 b(p,s) {\cal U}_2^{-1} = -b(-p,-s),
  • {\cal U}_2 d^\dagger(p,s) {\cal U}_2^{-1} = -d^\dagger(-p,-s).

Their realizations are:

  • {\cal U}_1 = e^{- i \int d^3\vec{p} \sum_s (\alpha_+(p,s) b^\dagger(p,s)b(p,s) -   \alpha_(p,s)d^\dagger(p,s)d(p,s))},
  • {\cal U}_2 = e^{- i \frac{\pi}2 \int d^3\vec{p} \sum_s (b^\dagger(p,s)b(p,s) + b^\dagger(p,s)b(-p,-s)  - d^\dagger(p,s)d(p,s) - d^\dagger(p,s)d(-p,-s))}.

Electromagnetic field

  • {\cal T}A^\mu(x){\cal T}^{-1} = A_\mu(\hat{x}),
  • {\cal U}\vec{a}^a(\vec{k}){\cal U}^{-1} = - (-)^a a^a(-\vec{k}),
  • {\cal U} = e^{\frac{i\pi}2 \int d^3k (a^\dagger(\vec{k})^a a(\vec{k})_a + (-)^a a^\dagger(\vec{k})^a a(-\vec{k})_a}.

Chord and Scale Pattern Generator

Filed under: music — Tags: , — sandokan65 @ 13:42

Source: I have lost the reference to the original source.

#! /bin/bash
# Allen Barker
# Sept. 17, 2004
# Chord and Scale Pattern Generator, Version 0.1.
# This is "human rights ware," copyright (C) Allen Barker, 2004.
# It can be freely copied and modified as long as the human
# rights message remains.  If you distribute modified copies,
# please document somewhere in the code, etc., that you have
# modified it.  (Yes, the code is ugly, but at least it works!)

numColumns="77"  # rounded down to the nearest factor of 4 plus 1
numRows="50" # rounded down to the nearest factor of 4 plus 1
nonMarkedChar=" "

function isMarked() {
   # Usage: isMarked 
   # Outputs "true" if note is in markedNotes, "false" otherwise.
   for i in $markedNotes
   do
      if [ "$1" == "$i" ] ; then
         echo "true"
	 return
      fi
   done
   echo "false"
   return
}

function addNotesMod12() {
   # Usage: addNotesMod12  
   note1=$1
   note2=$2
   if [ "$note1" == "a" ]; then (( note1=10 )); fi
   if [ "$note1" == "b" ]; then (( note1=11 )); fi
   if [ "$note2" == "a" ]; then (( note2=10 )); fi
   if [ "$note2" == "b" ]; then (( note2=11 )); fi
   (( sum = note1 + note2 ))
   if (( sum > 11 )); then (( sum -= 12 )); fi
   if (( sum == 10 )); then sum="a"; fi
   if (( sum == 11 )); then sum="b"; fi
   echo $sum
}

function transposeList() {
   # Usage: transposeList  
   # Adds the delta factor to all the notes on the list and returns
   # the transposed list via echo.

   delta=$1
   newList=""
   shift
   for i in $*
   do
      newList="$newList `addNotesMod12 $delta $i`"
   done
   echo $newList
}

function printRow() {
   # Usage: printRow 
   markedCols=""
   markedDiagCols1=""
   markedDiagCols2=""
   markedDiagCols3=""
   (( colCount = 1 ))
   while true
   do
      for note in $1 $2 $3
      do
	 if [ "`isMarked $note`" == "true" ]; then

	    # see if the previous note was marked...
	    prevNote=`addNotesMod12 $note 8`
	    if [ "`isMarked $prevNote`" == "true" ]; then
	       if (( colCount > 1 )); then 
	          echo -n "---"
	       fi
	    else
	       if (( colCount > 1 )); then 
	          echo -n "$nonMarkedChar$nonMarkedChar$nonMarkedChar"
	       fi
	    fi

	    # mark the columns for later...
	    belowNote=`addNotesMod12 $note 9`
	    if [ "`isMarked $belowNote`" == "true" ]; then
	       markedCols="$markedCols $colCount"
	    fi
	    belowLeft=`addNotesMod12 $note 5`
	    if [ "`isMarked $belowLeft`" == "true" ]; then
	       (( tmpCol = colCount-1 ))
	       markedDiagCols1="$markedDiagCols1 $tmpCol"
	       (( tmpCol = colCount-2 ))
	       markedDiagCols2="$markedDiagCols2 $tmpCol"
	       (( tmpCol = colCount-3 ))
	       markedDiagCols3="$markedDiagCols3 $tmpCol"
	    fi

	 else # not a marked note
	    if (( colCount > 1 )); then 
	       echo -n "$nonMarkedChar$nonMarkedChar$nonMarkedChar"
	    fi
	 fi

         (( colCount=colCount+4 ))
         echo -n $note
	 
         if (( colCount > numColumns )) ; then
            echo -n " " # this space is needed to make the sub to standard notes work
            echo
            return
         fi
      done

   done
}


function printBetweenRows() {
   # Usage: printBetweenRows
   # Uses the global column-marking lists.
   for betweenRow in 1 2 3
   do
      (( colCount = 1 ))
      (( mod4Count = 0 ))
      while true
      do
         if (( colCount > numColumns )) ; then
            echo
            break
         fi

         printedChar="false"
	 # loop to test if current column is marked
         for colTest in $markedCols
         do
            if (( colCount == colTest )) ; then
   	    echo -n "|"
   	    printedChar="true"
   	    fi
         done
	 if [ "$betweenRow" == "1" ]; then
	    markedDiagCols="$markedDiagCols1"
	 elif [ "$betweenRow" == "2" ]; then
	    markedDiagCols="$markedDiagCols2"
	 else # betweenRow ==3 
	    markedDiagCols="$markedDiagCols3"
	 fi
         for colTest in $markedDiagCols
         do
            if (( colCount == colTest )) ; then
   	    echo -n "/"
   	    printedChar="true"
   	    fi
         done

         # print the usual symbol if no marked char printed
         if [ "$printedChar" == "false" ]; then
            if (( mod4Count == 0 )); then
   	       echo -n "$nonMarkedChar"
	    elif (( mod4Count == 1 )); then
   	       if [ "$betweenRow" == "3" ]; then
   	          echo -n "$nonMarkedChar"
	       else
	          echo -n " "
	       fi
	    elif (( mod4Count == 2 )); then
   	       if [ "$betweenRow" == "2" ]; then
   	          echo -n "$nonMarkedChar"
	       else
	          echo -n " "
	       fi
	    elif (( mod4Count == 3 )); then
   	       if [ "$betweenRow" == "1" ]; then
   	          echo -n "$nonMarkedChar"
	       else
	          echo -n " "
	       fi
	    fi
   	 fi
         (( colCount=colCount+1 ))
         (( mod4Count=mod4Count+1 ))
         if (( mod4Count == 4 )); then (( mod4Count = 0 )); fi
      done
   done
}

#============================= Start Main Menu ============================

echo
echo
echo "-----------------------------------------------------------------------"
echo "Welcome to the chord and scale pattern generator, by Allen Barker, 2004."
echo "All notes are represented in base 12 for entry and default display,"
echo "but can be converted to standard note representations.  The (arbitrary)"
echo "convention is: 0=B 1=C 2=C# 3=D 4=D# 5=E 6=F 7=F# 8=G 9=G# a=A b=A#."
echo "Any yes/no menu choices default to \"n\" if nothing is entered."
echo "-----------------------------------------------------------------------"
echo "|\/\/\/\/\/\/\/\/\/\/\ Demand Human Rights! /\/\/\/\/\/\/\/\/\/\/\/\/\|"
echo "-----------------------------------------------------------------------"
echo
echo
echo "All preset patterns assume a root or key of 0, which can be"
echo "transposed.  Any user-entered note collections will also be transposed."
echo "(I.e., the transposition factor is added to all the notes mod 12;"
echo "transposing *down* by x is the same as transposing up by 12-x.)"
echo
echo "What root note/key to transpose to (where 0 = no transposition)?"
echo -n "Please enter a base 12 digit: [0123456789ab] "
read rootNote
if [ "$rootNote" == "" ]; then rootNote="0"; fi
echo
echo "What collection of notes would you like highlighted links between?"
echo "   1) major scale"
echo "   2) natural minor scale"
echo "   3) some mode of the major scale"
echo "   4) pentatonic minor scale"
echo "   5) pentatonic major scale"
echo "   6) harmonic minor scale"
echo "   7) melodic minor scale"
echo "   8) all notes, chromatic scale"
echo "   9) other, user-specified"
echo -n "Enter a choice: [1-6] "
read noteSet
if [ "$noteSet" == "" ]; then noteSet="9"; fi
if [ "$noteSet" = 1 ]; then
   markedNotes="2 5 9 0 4 7 b"
elif [ "$noteSet" = 2 ]; then
   markedNotes="5 8 0 3 7 a 2"
elif [ "$noteSet" = 3 ]; then
   echo
   echo "      Ionian = major scale; Aeolian = natural minor scale"
   echo
   echo "       Scale name   Root, relative to a major scale in key 0"
   echo "      1) Ionian               0"
   echo "      2) Dorian               2"
   echo "      3) Phrygian             4"
   echo "      4) Lydian               5"
   echo "      5) Mixolydian           7"
   echo "      6) Aeolian              9"
   echo "      7) Locrian              b"
   echo
   echo -n "      Enter the number 1-7 corresponding to the mode: "
   read modeName
   if [ "$modeName" == "" ]; then modeName="1"; fi

   if [ "$modeName" = 1 ]; then modeOffset="0"
   elif [ "$modeName" = 2 ]; then modeOffset="a"
   elif [ "$modeName" = 3 ]; then modeOffset="8"
   elif [ "$modeName" = 4 ]; then modeOffset="7"
   elif [ "$modeName" = 5 ]; then modeOffset="5"
   elif [ "$modeName" = 6 ]; then modeOffset="3"
   elif [ "$modeName" = 7 ]; then modeOffset="1"
   fi
   markedNotes="2 5 9 0 4 7 b"
   markedNotes="`transposeList $modeOffset $markedNotes`"

elif [ "$noteSet" = 4 ]; then
   markedNotes="0 3 5 7 a"
elif [ "$noteSet" = 5 ]; then
   markedNotes="0 2 4 7 9"
elif [ "$noteSet" = 6 ]; then
   markedNotes="2 5 8 0 b 3 7"
elif [ "$noteSet" = 7 ]; then
   markedNotes="0 2 3 5 7 9 b"
elif [ "$noteSet" = 8 ]; then
   markedNotes="0 1 2 3 4 5 6 7 8 9 a b"
elif [ "$noteSet" = 9 ]; then
   echo
   echo "   Please enter a list of notes from 0 to b, separated by spaces."
   echo "   (Be sure to use a and b for base 12 versions of 10 and 11.)"
   echo -n "   Notes as base 12 digits: "
   read markedNotes
   if [ "$markedNotes" == "" ]; then markedNotes="0"; fi
fi
echo
echo -n "Do you want a chord diagram printed after the table [yn]? "
read printChordDiagram
echo
outputFile="1"
echo -n "Do you want the output sent to a file? [yn] "
read yesno
if [ "$yesno" == "y" ]; then
   echo -n "Please enter the name of the file to write (or overwrite): "
   read outputFile
   if [ "$outputFile" == "" ]; then outputFile="1"; fi
   echo -n "Would you like the output to be in (very basic) HTML format? [yn] "
   read useHtml
   echo -n "Fire up a Mozilla process on the generated output file? [yn] "
   read mozillaProcess
fi
echo
echo -n "Do you want the output translated to standard note names? [yn] "
read useStandardNames
if [ "$useStandardNames" == "y" ]; then
   echo "   By arbitrary convention, 0=B, 1=C, 2=C#, etc."
   echo -n "   Use sharp symbol (#) or flat symbol (b)? [#b] "
   read sharpOrFlat
fi
echo
echo -n "Select a number of columns and rows other than the default? [yn] "
read yesno
if [ "$yesno" == "y" ]; then
   echo "All numbers rounded down to the nearest multiple of four plus one."
   echo -n "Enter the number of rows: "
   read numRows
   if [ "$numRows" == "" ]; then numRows="50"; fi
   echo -n "Enter the number of columns: "
   read numColumns
   if [ "$numColumns" == "" ]; then numColumns="78"; fi
fi
echo
title="Note Pattern Diagram" # default title
echo -n "Do you want a title printed at the top of the page? [yn] "
read printTitle
if [ "$printTitle" == "y" ]; then
   echo -n "Enter the title here: "
   read title
   fi
echo
echo

# Round down the row and column numbers.
(( numColumns = (numColumns - 1) / 4 * 4 + 1 ))
(( numRows = (numRows - 1) / 4 * 4 + 1 ))

# transpose after all other options chosen
markedNotes=`transposeList $rootNote $markedNotes`

# these defs are for translating to standard note names with sed
(( rs = 1 )) # start row for diagram
if [ "$useHtml" == "y" ]; then (( rs = rs + 6 )); fi
if [ "$printTitle" == "y" ]; then (( rs = rs + 2 )); fi
(( re = rs + numRows )) # end row for diagram, 3 to cover overspill

if [ "$useStandardNames" == "y" ]; then
   if [ "$sharpOrFlat" == "#" ]; then
      x0="0-"; x1="1-"; x2="2-"; x3="3-"; x4="4-"; x5="5-"
      x6="6-"; x7="7-"; x8="8-"; x9="9-"; xa="a-"; xb="b-"
      y0="B-"; y1="C-"; y2="C#"; y3="D-"; y4="D#"; y5="E-"
      y6="F-"; y7="F#"; y8="G-"; y9="G#"; ya="A-"; yb="A#"
      z0="0 "; z1="1 "; z2="2 "; z3="3 "; z4="4 "; z5="5 "
      z6="6 "; z7="7 "; z8="8 "; z9="9 "; za="a "; zb="b "
      w0="B "; w1="C "; w2="C#"; w3="D "; w4="D#"; w5="E "
      w6="F "; w7="F#"; w8="G "; w9="G#"; wa="A "; wb="A#"
   else
      x0="0-"; x1="1-"; x2="2-"; x3="3-"; x4="4-"; x5="5-"
      x6="6-"; x7="7-"; x8="8-"; x9="9-"; xa="a-"; xb="b-"
      y0="B-"; y1="C-"; y2="Db"; y3="D-"; y4="Eb"; y5="E-"
      y6="F-"; y7="Gb"; y8="G-"; y9="Ab"; ya="A-"; yb="Bb"
      z0="0 "; z1="1 "; z2="2 "; z3="3 "; z4="4 "; z5="5 "
      z6="6 "; z7="7 "; z8="8 "; z9="9 "; za="a "; zb="b "
      w0="B "; w1="C "; w2="Db"; w3="D "; w4="Eb"; w5="E "
      w6="F "; w7="Gb"; w8="G "; w9="Ab"; wa="A "; wb="Bb"
   fi
else # null translation
      x0="0-"; x1="1-"; x2="2-"; x3="3-"; x4="4-"; x5="5-"
      x6="6-"; x7="7-"; x8="8-"; x9="9-"; xa="a-"; xb="b-"
      y0="0-"; y1="1-"; y2="2-"; y3="3-"; y4="4-"; y5="5-"
      y6="6-"; y7="7-"; y8="8-"; y9="9-"; ya="a-"; yb="b-"
      z0="0 "; z1="1 "; z2="2 "; z3="3 "; z4="4 "; z5="5 "
      z6="6 "; z7="7 "; z8="8 "; z9="9 "; za="a "; zb="b "
      w0="0 "; w1="1 "; w2="2 "; w3="3 "; w4="4 "; w5="5 "
      w6="6 "; w7="7 "; w8="8 "; w9="9 "; wa="a "; wb="b "
fi

{ # <-- start a block, to redirect output to a file if selected
(( row = 0 ))
# if you change the preamble text, be sure to modify
# rs and re above (outside this block scope) to fix number of lines
if [ "$useHtml" == "y" ]; then
echo ""
echo ""
echo "$title"
echo ""
echo ""
echo "
"
fi

if [ "$printTitle" == "y" ]; then
   echo $title
   echo
   (( row = row + 2 )) # these appear on the page, so count as rows
fi

while true
do

   printRow 0 4 8
   (( row = row + 1 ))
   if (( row >= numRows )); then break; fi
   printBetweenRows

   printRow 9 1 5
   (( row = row + 4 ))
   if (( row >= numRows )); then break; fi
   printBetweenRows

   printRow 6 a 2
   (( row = row + 4 ))
   if (( row >= numRows )); then break; fi
   printBetweenRows

   printRow 3 7 b
   (( row = row + 4 ))
   if (( row >= numRows )); then break; fi
   printBetweenRows
   (( row = row + 3 ))

done

echo

if [ "$printChordDiagram" == "y" ]; then
   echo  
   echo "Chords with root 0 (the pattern is the same for all chords):"
   echo
   echo "                             9th=7th+add9"
   echo "3rd 3--7 5th   7 5th         7th a  2 add9          9 7th   0--4--7"
   echo "    | /       /|                 | /  (-3rd=sus2)   |"
   echo "    |/       / |                 |/                 |       augmented"
   echo "    0       0--4 3rd             7--b maj7          6"
   echo "  root    root                  /|                  |"
   echo "                               / |                  |"
   echo " minor     major              0--4                  3"
   echo "                             /|                     |"
   echo "                            / |                     |"
   echo "                      sus4 5  9                     0"
   echo "                    (-3rd)   6th"
   echo "                                                  diminished"
   echo 
   echo "Note the cycle of 5ths along the / diagonals; counting along the \ diagonals."
   echo "Note guitar/bass fretboard pattern (minus \"guitar bump\") along alternate \ diags."
   echo "Standard note convention: 0=B 1=C 2=C# 3=D 4=D# 5=E 6=F 7=F# 8=G 9=G# a=A b=A#"
   echo
  
fi

if [ "$useHtml" == "y" ]; then
   echo "

"
echo ""
echo ""
fi

} | \
sed -e "$rs,$re s/$xb/$yb/g" -e "$rs,$re s/$x1/$y1/g" -e "$rs,$re s/$x2/$y2/g" \
-e "$rs,$re s/$x3/$y3/g" -e "$rs,$re s/$x4/$y4/g" -e "$rs,$re s/$x5/$y5/g" \
-e "$rs,$re s/$x6/$y6/g" -e "$rs,$re s/$x7/$y7/g" -e "$rs,$re s/$x8/$y8/g" \
-e "$rs,$re s/$x9/$y9/g" -e "$rs,$re s/$xa/$ya/g" -e "$rs,$re s/$x0/$y0/g" \
-e "$rs,$re s/$zb/$wb/g" -e "$rs,$re s/$z1/$w1/g" -e "$rs,$re s/$z2/$w2/g" \
-e "$rs,$re s/$z3/$w3/g" -e "$rs,$re s/$z4/$w4/g" -e "$rs,$re s/$z5/$w5/g" \
-e "$rs,$re s/$z6/$w6/g" -e "$rs,$re s/$z7/$w7/g" -e "$rs,$re s/$z8/$w8/g" \
-e "$rs,$re s/$z9/$w9/g" -e "$rs,$re s/$za/$wa/g" -e "$rs,$re s/$z0/$w0/g" \
1>&$outputFile

if [ "$mozillaProcess" == "y" ]; then
if [ "$outputFile" != "1" ]; then
exec mozilla $outputFile
fi
fi

Command line based text replace

sed

  • sed 's/Mark Monre/Marc Monroe/' 1.txt > 2.txt
  • find ./* -type f -exec sed -i 's///g' {} \;

The “replace” command

  • Syntax:
    replace OLD-STRING NEW-STRING OUTPUT-FILE
  • Example:
    $ replace UNIX Linux  newfile
  • Example:
    $ cat /etc/passwd | replace : '|'
  • Partial support for regular expressions: \^ – matches start of line, and $ matches end of line.
  • Example: replace all IP address 192.168.1.2 start of line:
    $ replace \^192.168.1.2 192.168.5.10  newfile
  • a bash script, ‘fixer.sh’
    #!/bin/bash
    replace CHANGEFROM CHANGETO $1.tmp
    rm $1
    mv $1.tmp $1
    

    now run this command line:

    $ grep CHANGEFROM |cut -d':' -f1 |xargs -n 1 fixer.sh

    the results is that all files in the directory (or whatever you grep for) will be changed automagically.
    just make sure the grep doesn’t include the fixer script itself, or it will die half-way through changing when execute permissions are reset!


Perl


Sources:


Related: Regular expressions – https://eikonal.wordpress.com/2010/04/02/regular-expressions/ | Perl online – https://eikonal.wordpress.com/2010/02/15/perl-online/

Enforcing password virtues in Linux

Filed under: security hardening — Tags: , , , — sandokan65 @ 11:16

The Newman-Penrose tetrade

Source: The Holographic Principle and the Renormalization Group, Enrique Alvarez and Cesar Gomez, arXiv:hep-th/9810102v1, 1998.10.14 – http://arxiv.org/abs/hep-th/9810102.

In terms of a real orthonormal tetrad e^a:

  • l :\equiv l^\mu\partial_\mu \equiv e^+ \equiv \frac1{\sqrt{2}}(e^0+e^3),
  • n :\equiv n^\mu\partial_\mu \equiv e^- \equiv \frac1{\sqrt{2}}(e^0-e^3),
  • m :\equiv m^\mu\partial_\mu \equiv e_T \equiv \frac1{\sqrt{2}}(e^1-i e^2),
  • \bar{m} :\equiv \bar{m}^\mu\partial_\mu \equiv \bar{e}_T \equiv \frac1{\sqrt{2}}(e^1+i e^2).

Properties:

  • l^2=n^2=m^2=\bar{m}^2=0,
  • l\cdot n =1, m\cdot\bar{m}=-1,
  • l\cdot m=l\cdot\bar{m}=n\cdot m=n\cdot\bar{m}=0.

Some optical scalars:

  • \rho :\equiv - \nabla_\mu l_\nu m^\nu\bar{m}^\mu = - (\theta+i\omega),
  • \theta :\equiv \frac12\nabla_\alpha l^\alpha \ \ (expansion),
  • \omega^2 :\equiv \frac12\omega_{\alpha\beta}\omega^{\alpha\beta}, \ (rotation),
  • \omega_{\alpha\beta} :\equiv \nabla_{[\alpha}l_{\beta]}.

Raychadhuri theorem:

  • l^\mu\nabla_\mu\theta = \omega^2-\frac12R_{\mu\nu}l^\mu l^\nu - \sigma\bar{\sigma} - \theta^2.
  • Here the shear \sigma\bar{\sigma} is given by: \sigma\bar{\sigma} :\equiv  \frac12\nabla_{[\alpha}l_{\beta]}\nabla^{[\alpha}l^{\beta]} - \frac14(\nabla_\alpha l^\alpha)^2.

See also:

2010.07.12

netcat

Filed under: infosec, tools — Tags: — sandokan65 @ 23:34
Older Posts »

Blog at WordPress.com.