Setup
Windows side
WSL side
cd WSL2-Linux-Kernelcp Microsoft/config-wsl .configscripts/config --enable USB_STORAGEmake oldconfig
make -j$(nproc)cp arch/x86/boot/bzImage /c/Users/<windows-user>/
cd WSL2-Linux-Kernelcp Microsoft/config-wsl .configscripts/config --enable USB_STORAGEmake oldconfig
make -j$(nproc)cp arch/x86/boot/bzImage /c/Users/<windows-user>/
I recently learned about Gemini and how its development is being tracked on Usenet. This got me interested in accessing Usenet.
sudo apt-get install tin
news.eternal-september.org <password> <username>
All of this information came from the registration email I got from eternal-septemeber.
sudo dhclient usb0 instead of sudo dhcpcd usb0 if you are using the terminal).pixel sftp://abid:xx@pixel
where my ssh config section is titled "pixel" and the password "xx" is just a red-herring since ssh is configured to use an RSA key for authentication. This bookmark allows me to access my phone's files using a simple lftp pixel.
authorized_keys.ssh -o StrictHostKeyChecking=no -p 2222 -i <private key location> <phone ip address>
You will need to issue StrictHostKeyChecking=no the first time only.
~/.ssh/config).
Host pixel
Hostname 192.168.42.129
Port 2222
IdentityFile ~/.ssh/pixel
and simply run ssh pixel to connect.
usb0 Link encap:Ethernet HWaddr 32:a8:e6:6c:fe:9d
inet6 addr: fe80::30a8:e6ff:fe6c:fe9d/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:5 errors:0 dropped:0 overruns:0 frame:0
TX packets:13 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:560 (560.0 B) TX bytes:1802 (1.8 KB)
sudo apt-get install dhcpcd
Now after connecting the Google Pixel simply run:
sudo dhcpcd usb0
And confirm by running:
ifconfig usb0
route -n
ping -c3 www.google.com
sudo apt-get install pptp-linux/etc/ppp/peers/comsats with the following content
pty "pptp <vpn server ip address> --nolaunchpppd"
debug
nodetach
logfd 2
noproxyarp
ipparam comsats
remotename comsats
name <vpn username>
require-mppe-128
nobsdcomp
nodeflate
lock
noauth
refuse-eap
refuse-chap
This file needs to be executable (sudo chmod +x /etc/ppp/peers/comsats). Note the 'remotename' and the 'ipparam' which are set to 'comsats'. These will be used to activate the connection and to run automated scripts when the connection is setup and torn down.
/etc/ppp/chap-secrets in the following format:
* <vpn username> * <vpn password>
At this point you can check your vpn connection by executing:
sudo pon comsats
For debugging the connection look at /var/log/syslog. At this stage your internet will NOT be forwarded over the vpn because the routes haven't been set up for it.ps -A | grep ppp to find the pid of the connection process and then sudo kill -KILL <pid> to kill it.
route command, it will show you the current default gateway. sudo route delete gw 192.168.0.1 wlan0
Note the use of my wlan0 gateway ip address (192.168.0.1). sudo route add gw 192.168.3.1 ppp0
You can confirm the switch to using the VPN by looking at your external IP address (I simply navigate to https://www.icanhazip.com and a whois to confirm).
sudo route delete gw 192.168.3.1 ppp0
sudo add gw 192.168.0.1 wlan0
#!/bin/sh
[ "$PPP_IPPARAM" = "comsats" ] || exit 0
route delete default gw 192.168.0.1 wlan0
route add default gw 192.168.3.1 ppp0
Note how we use the $PPP_IPPARAM to match against the same we defined in /etc/ppp/peers/comsats to make the code run only when this connection is set up. #!/bin/sh
[ "$PPP_IPPARAM" = "comsats" ] || exit 0
route delete default gw 192.168.3.1 ppp0
route add default gw 192.168.0.1 wlan0
Finally comment out nodetach in /etc/ppp/peers/comsats to run the connection as a deamon and use sudo poff comsats to close the connection when you need to. This connection is not as stable as I would like it (usable however) so I use tail -F /var/log/syslog | ccze -A to keep an eye on the connection while I am using it, restarting it as needed.
<link href='//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/styles/agate.min.css' rel='stylesheet'/>
<script src='//cdnjs.cloudflare.com/ajax/libs/highlight.js/9.8.0/highlight.min.js'/>
<script>hljs.initHighlightingOnLoad();</script>
<pre><code> </code></pre> block or simply inside <code> </code> if quoting code inline. You can specify the language inside the "class" element of the "code" block (visit the highlight.js website for more details). def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n - 1)
<pre><code class="python"> def factorial(n):
if n == 0:
return 1
else:
return n * factorial(n - 1)
</code></pre>
sleep 5 && xrandr -d :0 --output LVDS1 --auto
--output LVDS1 --auto tells xrandr to switch to the internal display with default settings.
Host <name>
User <user>
Hostname <host address>
IdentityFile <full path to ssh key file>
DynamicForward <port>
ServerAliveInterval 60
sudo iptables -F
sudo iptables -t nat -F
sudo iptables -t nat -A PREROUTING -s 10.42.0.0/24 -p tcp -j REDIRECT --to-ports 12345
sudo sysctl -w net.ipv4.ip_forward=1
\begin{figure}
\begin{circuitikz}
\draw (0,0)
to[V,v=$U_q$] (0,2) % The voltage source
to[short] (2,2)
to[R=$R_1$] (2,0) % The resistor
to[short] (0,0);
\end{circuitikz}
\caption{My first circuit.}
\end{figure}
and it creates the following circuit diagram:
tlmgr install circuitikz
tlmgr install siunitx
A little over a year ago when my wife gave me the Lego Mindstorms EV3 as the most awesome of birthday presents I started tinkering with it in an attempt to use Linux to program it. This led me to discover LeJOS. The subsequent joy of discovery moved me to create this blog and post what I learned about it.
These posts brought me to the attention of Packt publishers who commissioned me to write a book on the subject. That book has now been completed and is available on Amazon (amongst other places): Lego Mindstorms EV3 Essentials
The book is in essence a pedagogically rich instruction manual on how to program the EV3 using both the on-brick visual programming language and using Java by installing LeJOS. The primary focus of the book is using LeJOS while programming on a Linux machine. So if you are a robotics enthusiast who is comfortable with Linux (and really one cannot call themselves an enthusiast of any computer related field if one doesn't learn Linux) then you will love the detailed information this book provides on how to program the EV3 on that great OS. The fact that the EV3 runs Linux itself should be reason enough.
To get an idea of how the book presents its material you need go no further than this blog itself, which is the inception of the book, and the detailed information Packt have provided on their website: Packt Publishers - Lego Mindstorms EV3 Essentials.
hciconfig -a
This will spit out a bunch of information:
hci0: Type: BR/EDR Bus: USB
BD Address: 00:16:CF:FE:03:A0 ACL MTU: 1017:8 SCO MTU: 64:8
UP RUNNING PSCAN ISCAN
RX bytes:301012 acl:2298 sco:0 events:460 errors:0
TX bytes:94808 acl:966 sco:0 commands:67 errors:0
Features: 0xff 0xff 0x8d 0xfe 0x9b 0xfd 0x00 0x80
Packet type: DM1 DM3 DM5 DH1 DH3 DH5 HV1 HV2 HV3
Link policy: RSWITCH HOLD SNIFF PARK
Link mode: SLAVE ACCEPT
Name: 'Abid-Laptop'
Class: 0x6e010c
Service Classes: Networking, Rendering, Capturing, Audio, Telephony
Device Class: Computer, Laptop
HCI Version: 2.0 (0x3) Revision: 0x20da
LMP Version: 2.0 (0x3) Subversion: 0x4182
Manufacturer: Broadcom Corporation (15)
Look for "Networking" in 'Service Classes' and "Computer" in 'Device Class'. In addition we need a useful 'Name'. To change it issue:
sudo hciconfig hci0 name '<device name>'
To connect to the EV3 (running LeJOS) turn it on and navigate to the "Bluetooth" menu. Make sure that it says "Visibility on". Now on your computer issue: hcitool scan
The response should look like:
Scanning ...
00:16:53:40:E9:7D EV3
We will need the Bluetooth address of the EV3 (the 12 hexadecimal number interspersed with colons) and the IP address of the EV3 on the PAN (displayed on the EV3 screen - 10.0.1.1 in my case). To connect to the EV3 as a PANU client one uses the pand utility (from the bluez-compat package):sudo pand --connect 00:16:53:40:E9:7D
The PAN has been established but we need to start the bnep0 network interface manually on the computer to allow us to access the EV3 over the bluetooth PAN. Since the EV3 has IP address 10.0.1.1 we choose for our computer 10.0.1.2 (the first three numbers (sub-domain) need to match, the last one can be any number from 2 to 255):
sudo ifconfig bnep0 10.0.1.2
To confirm that the bnep0 network interface is active simply run: ifconfig
and look for:
bnep0 Link encap:Ethernet HWaddr 84:a6:c8:9b:ce:58
inet addr:10.0.1.2 Bcast:10.255.255.255 Mask:255.0.0.0
inet6 addr: fe80::86a6:c8ff:fe9b:ce58/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:670 errors:0 dropped:0 overruns:0 frame:0
TX packets:7 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:30820 (30.8 KB) TX bytes:428 (428.0 B)
To confirm connectivity with the EV3 we ping it: ping -c3 10.0.1.1
One can ssh in to the EV3 using IP Address 10.0.1.1, username "root" and blank password: ssh root@10.0.1.1
It helps with automation if you set up an SSH private/public key-pair and store the public key in /home/root/.ssh/authorized_keys allowing password-less access.
Finally to disconnect the computer from the EV3 PAN issue: sudo pand -K
Host ev3
User root
HostName 192.168.1.16
IdentityFile ~/.ssh/abid_ev3
Note: Since the wifi setup on the EV3 is DHCP (not static) the IP address is liable to change, in which event one has to modify ~/.ssh/config accordingly.
apply plugin: 'java'
def main_class = "Rover" // We define the main class of the project
// We set the Version of the Java SDK to the one on the system: 1.6
sourceCompatibility = 1.6
sourceSets {
main {
// We specify the source directories for the project. The first one is created by us while the latter two are part of the LeJOS source and provide
// essential classes for controlling the EV3.
java {
srcDirs = ['src', '/home/abid/applications/lejos/ev3/DBusJava/src', '/home/abid/applications/lejos/ev3/ev3classes/src']
}
// We specify the jar library required to compile the project. This provides the com.sun.jna package
dependencies {
compile files('/home/abid/applications/lejos/ev3/ev3classes/lib/jna-3.2.7.jar')
}
// We specify manifest attributes (key-value pairs that must appear in the META-INF/MANIFEST>MF file inside the output Jar for the EV3 to run it correctly.
// Additionally we supply the name of the Main-Class which is the starting point of the program execution.
jar {
manifest {
attributes("Main-Class": main_class, "Class-Path": "/home/root/lejos/lib/ev3classes.jar /home/root/lejos/libjna/usr/share/java/jna.jar")
}
}
}
}
This is pretty much a template build.gradle file for any LeJOS EV3 project. The one-time alterations needed are to change the latter two srcDirs to point to the locations in the local LeJOS git repo as well as the jna jar dependency in the same.