# Least Action

Nontrivializing triviality..and vice versa.

## Colored terminal on the Mac

~/.bash_profile

export CLICOLOR=1
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
#export LSCOLORS=”ExGxBxDxCxEgEdxbxgxcxd”

Written by Vivek

March 8, 2018 at 13:53

Posted in Linux, Mac, Uncategorized

Tagged with

## Fun with Homology

There is a theorem (currently being attributed to Wikipedia, but I’m sure I can do better given more time) which states that

All closed surfaces can be produced by gluing the sides of some polygon and all even-sided polygons (2n-gons) can be glued to make different manifolds.

Conversely, a closed surface with $n$ non-zero classes can be cut into a 2n-gon.

Two interesting cases of this are:

1. Gluing opposite sides of a hexagon produces a torus $T^2$.
2. Gluing opposite sides of an octagon produces a surface with two holes, topologically equivalent to a torus with two holes.

I had trouble visualizing this on a piece of paper, so I found two videos which are fascinating and instructive, respectively.

The two-torus from a hexagon

The genus-2 Riemann surface from an octagon

I would like to figure out how one can make such animations, and generalizations of these, using Mathematica or Sagemath.

There are a bunch of other very cool examples on the Youtube channels of these users. Kudos to them for making such instructive videos!

PS – I see that \$\LaTeX\$ on WordPress has become (or is still?) very sloppy! 😦

Written by Vivek

October 20, 2016 at 21:57

## Intel Skylake graphics flicker on Arch Linux

Recently, I had the opportunity to install Arch Linux on a brand new laptop based on the Intel Skylake architecture. Immediately after installing Google Chrome, I began to experience intense screen flicker. I came across a post on the Arch Linux forums where someone suggested the following solution to this problem:

1. (As root), create a file named 20-intel.conf in /etc/X11/xorg.conf.d.
2. Open the file in your favorite editor (I use vim, so steps 1 and 2 can be combined) and enter the following lines in the file
``````Section "Device"
Identifier  "Intel Graphics"
Driver      "intel"
#Option      "AccelMethod"  "sna"
Option      "TearFree"    "true"
Option      "DRI"    "3"
EndSection
``````

Now, restart X Windows, and the flicker should go away.

Written by Vivek

April 10, 2016 at 10:34

Posted in Linux

Tagged with ,

## Getting sound to work in Arch Linux

Make the following file in your home directory (~/) and save it as .asoundrc (note the leading .)

``````pcm.!default {
type hw
card 1
}

ctl.!default {
type hw
card 0
}``````

Written by Vivek

July 16, 2015 at 11:15

Posted in Linux

Tagged with ,

## ~/.xinitrc and /etc/X11/xorg.conf for Arch Linux Optimus configuration

~/.xinitrc

xrandr –setprovideroutputsource modesetting NVIDIA-0
xrandr –auto
#xrandr –output VGA-1-0 –off
#xrandr –output VGA-1-0 –left-of VGA-I-1 –mode 1920×1080 –gamma 1.2:1.2:1.2
xrandr –output VGA-I-1 –primary –mode 1920×1080
exec startkde

/etc/X11/xorg.conf (to be used with nvidia driver, not otherwise)

Section “ServerLayout”
Identifier “layout”
Screen 0 “nvidia”
Inactive “intel”
EndSection

Section “Device”
Identifier “nvidia”
Driver “nvidia”
BusID “PCI:1:0:0”
Option “ConstrainCursor” “0”
Option “nvidiaXineramaInfoOverride” “1920×1080+0, 1920×1080+0”
EndSection

Section “Screen”
Identifier “nvidia”
Device “nvidia”
Option “AllowEmptyInitialConfiguration” “Yes”
Option “ConnectedMonitor” “CRT-0”
Option “CustomEDID” “CRT-0:/sys/class/drm/card0-LVDS-1/edid”
Option “IgnoreEDID” “false”
Option “UseEDID” “true”
EndSection

Section “Device”
Identifier “intel”
Driver “modesetting”
BusID “PCI:0:2:0”
Option “AccelMethod” “sna”
EndSection

Section “Screen”
Identifier “intel”
Device “intel”
EndSection

Written by Vivek

July 15, 2015 at 02:47

Posted in Linux

Tagged with ,

## Installing Cadabra in Arch Linux

Cadabra is available on the AUR for Arch Linux, but one of the required libraries called conlie, has the wrong upstream URL in the default PKGBUILD.
conLiE.tar.gz is available here: http://www.filewatcher.com/m/conLiE.tar.gz.361170-0.html

A sample PKGBUILD for conlie, which you can edit while installing Cadabra, is listed below. I have changed the md5sum relative to the ones in the original (as of July 15, 2015, it hasn’t been updated).

# Contributor: Dariusz ‘quasi’ Panchyrz <quasi@aur.archlinux.org>

pkgname=conlie
pkgver=2.2.2
pkgrel=2
pkgdesc=”A Computer algebra package for Lie group computations”
arch=(‘i686’ ‘x86_64’)
url=”http://wwwmathlabo.univ-poitiers.fr/~maavl/LiE/&#8221;
install=\$pkgname.install
source=(http://wwwmathlabo.univ-poitiers.fr/~maavl/LiE/conLiE.tar.gz lie lie.1)
md5sums=(‘2e98f252364d43557a322ea7eb677944’
‘a47060395617ed656eaccde1a9e9ee93’)

build() {
cd LiE

make
}

package() {
cd LiE

install -D Lie.exe \$pkgdir/usr/bin/Lie.exe
install -D \$srcdir/lie \$pkgdir/usr/bin/lie

mkdir -p \$pkgdir/usr/lib/lie
for i in INFO.* LEARN.ind
do
cp \$i \$pkgdir/usr/lib/lie/
done

install -D manual/manual.dvi \$pkgdir/usr/share/doc/lie/manual.dvi

install -D \$srcdir/lie.1 \$pkgdir/usr/share/man/man1/lie.1
}

Written by Vivek

July 15, 2015 at 01:33

Posted in Linux

Tagged with ,

## Connecting to an MSCHAPV2-based wireless network in Arch Linux

Arch Linux comes with “wifi-menu”, but this does not let you connect to a WPA2-based network which requires you to enter both a login-id as as well as a password. Some of these networks use MSCHAPV2, which due its vulnerabilities, is not recommended by the Arch community (see https://wiki.archlinux.org/index.php/WPA2_Enterprise). On the campus I am currently stationed in, we have a MSCHAPV2-based network known as WolfieNet-Secure, the alternative to which is an unsecured wifi connection. The university does not currently offer any Linux support and their instructions for configuring WolifeNet-Secure in Linux work only for Ubuntu (which comes with out of the box MSCHAPV2 support).

This is a quick and fast way to get such a network connection to work in Arch Linux. But this is not the best way, and I strongly suggest using it once to set up Arch Linux but switch to Network Manager once you have X Windows working. This is particularly important if you are behind such a network, cannot get access to a network cable, and must install Arch Linux off the net.

Step 1: Bring up the interface.

ip link set wlp5s0 up

Replace wlp5s0 with your wireless interface.

Step 2: As superuser, create a new file /etc/wpa_supplicant/example.conf, with the following

ctrl_interface=/run/wpa_supplicant
update_config=1

Step 3: Start wpa_supplicant using

wpa_supplicant -B -i wlp5s0 -c /etc/wpa_supplicant/example.conf

Step 4: Create a script which connects to the network.

#!/bin/bash

wpa_cli -wlps5s0 disconnect
wpa_cli -wlp5s0 set_network 0 auth_alg OPEN
wpa_cli -wlp5s0 set_network 0 key_mgmt WPA-EAP
wpa_cli -wlp5s0 set_network 0 pairwise CCMP
wpa_cli -wlp5s0 set_network 0 group CCMP
wpa_cli -wlp5s0 set_network 0 proto WPA2
wpa_cli -wlp5s0 set_network 0 eap PEAP
wpa_cli -wlp5s0 set_network 0 identity “login-id
wpa_cli -wlp5s0 set_network 0 phase1 “peapver=0”
wpa_cli -wlp5s0 set_network 0 phase2 “MSCHAPV2”
wpa_cli -wlp5s0 set_network 0 mode 0
wpa_cli -wlp5s0 set_network 0 ssid “WolfieNet-Secure”
wpa_cli -wlp5s0 select_network 0
wpa_cli -wlp5s0 enable_network 0
wpa_cli -wlp5s0 reassociate
wpa_cli -wlp5s0 status

Save this file in your /usr/bin or your home folder, for instance by an unimaginative name like “wificonnect” and then make it an executable using

chmod +x wificonnect

Step 5: run dhcpcd (this may be optional in some setups)

dhcpcd wlp5s0

Finally, add the script to your system startup. I find it convenient to actually execute it by hand for now. But if you work mostly in X Windows, then doing so manually may be an annoyance.

A drawback of the above script is that your password is stored in plaintext. This is easily fixable, and one can introduce a layer of encryption. Documentation for this is easily available on the internet and is a matter of common knowledge among experienced users of Linux, so I won’t go into this in more detail.

Notes:

1. dhcpcd will usually run by itself if you enabled it using

systemctl enable dhcpcd.service

Another issue is that on some laptops, due to shaky network adapter support, it may be useful to first connect to an open wifi network (if one is available) to get the interface running, before switching over to a secure wifi using the above script.

2. If you have multiple profiles, it may become necessary to change the number 0 which appears after each set_network command in the above script, to 1 or some other number. To verify this, one can run

wpa_cli

and type each line of the above script after removing the leading “spa_ctl -wlp5s0” statements. The add_network command will return a number, which if other than 0, must be entered in the script above.

There may be additional tweaks or caveats, which I may update in future.

Written by Vivek

July 12, 2015 at 21:27

Posted in Linux

Tagged with