lunes, 24 de octubre de 2016

CAD 3D, figures orgàniques, etc


Una barreja de openscad i python
https://github.com/SolidCode/SolidPython

Corbes i superfícies NURBS. Relacionat amb corbes de beziers.

Python i Rhino. Rhino és un software comercial que sembla potent
https://en.wikipedia.org/wiki/Rhinoceros_3D
Buscar "Python Rhinoceros". Surt tutorial guapo

Algorisme per suavitzar objectes
https://en.wikipedia.org/wiki/Catmull%E2%80%93Clark_subdivision_surface

Objectes guapos fets amb Rhinoceros
http://www.shapeways.com/product/4KM9MDWCH/klein-bottle?optionId=161525&li=related-items-solr

El blog que ha inspirat aquestes cerques. Barreja openscad i altres
http://kitwallace.tumblr.com/post/134738715634/catmull-clark-surface-smoothing

Un tutorial de openscad 3D
http://www.tridimake.com/2014/09/how-to-use-openscad-tricks-and-tips-to.html

viernes, 12 de agosto de 2016

Using rsync to copy a movie and start watching inmediately

Sometimes I want to watch a movie that is on my home server. With standard copy you have to wait for the whole file to be transferred.

The following bash script does it:

#!/bin/bash
rsync -aP --inplace user@x.y.z:/home/mydir/"${1// /\\ \\}" .


Usage
myscript 'filename perhaps with spaces in it'

Explanations
--inplace makes the file inmediately accessible for playing.
The strange items instead of $1 escape spaces in the filename.
Do not forget the trailing dot '.'

martes, 9 de agosto de 2016

WiFi disabled by hardware switch

On my compaq presario cq60 laptop, WiFi gets sometimes off and there is no way to reactivate it: the network manager keeps saying "WiFi disabled by hardware switch". The hardware button does nothing. In fact, when working correctly the hardware LED is sometimes red, sometimes blue but keeps working!

This is probably a driver issue.
Things to try

rfkill list all
rfkill unblock all

But these do not work for me.

What does work is shut down the PC and, while restarting, press thousands of times the WiFi button.

martes, 21 de junio de 2016

Network Manager CLI

nmcli device list




OpenVPN howto

  1. Download the OpenVPNConfigFile.ovpn. Note that you can rename the file to anything you like.
  2. Move the oven file to /etc/openvpn
  3. cd /etc/openvpn folder and enter sudo nano yourserver.txt
    your_server_user_name
    your_server_passowrd
    
    Save and Close
  4. sudo nano OpenVPNConfigFile.ovpn
    Find auth-user-pass and add yourserver.txt next to it so that it becomes
    auth-user-pass yourserver.txt
    
    This will allow you to skip entering your credentials everytime you start openvpn connection
  5. Rename OpenVPNConfigFile.ovpn to OpenVPNConfigFile.conf
    sudo mv OpenVPNConfigFile.ovpn OpenVPNConfigFile.conf
    
  6. sudo nano /etc/default/openvpn
    Uncomment AUTOSTART="all"
  7. sudo service openvpn start
    You should see a message saying that you are connected. The connection will be established every time you start your computer.


> On the server machine i run the init script and openvpn starts up fine. 
> On the client machine i do the same but get prompted for a private key
> password.  I put in the password and the connection is built and things
> work fine.  
> 
> Why am i getting this password prompt on one machine and not the other. 
> I'm assuming that it's the tls-auth that is asking for the password, is
> that correct? 
> 
> If i want the vpn to come up automatically if the machine reboots or
> power cycles or whatever, what do i have to do?
> 

You should check, if your key is password protected. For security
reasons this is very useful - you need to have the key and you need to
have knowledge of the passphrase to authenticate yourself against the
server.

If you want to remove the passphrase you can use the openssl command as
follows:
"openssl rsa -in client.key -out client.key"

I hope this is helpful
leh

domingo, 1 de mayo de 2016

Climber Model

Hi ha alguna font, però no tot suma el 100% https://www.quora.com/Whats-the-weight-distribution-in-the-average-human-body






75
Trunk 50.80% 50.6 38.1
Thigh 9.88% 9.88 7.41
Head 7.30% 7.3 5.475
Lower leg 4.65% 4.65 3.4875
Upper arm 2.7% 2.7 2.025
Forearm 1.60% 1.6 1.2
Foot 1.45% 1.45 1.0875
Hand 0.66% 0.66 0.495




78.84 59.28



He trobat això: http://www.humanics-es.com/ADA304353.pdf
i això http://people.unica.it/brunoleban/files/2012/04/Drills-Contini-1966-Body-Segment-Parameters.pdf

GoPro

Software lliure per controlar la GoPro, aquí.

Manual de la GoPro Hero3+ silver, aquí.

viernes, 15 de abril de 2016

Dual Monitor in LXDE

La clau està en instal·lar el arandr. Informació general aquí.

I created two scripts in the .screenlayout/ directory with the help of ARandR:



~/.screenlayout$ cat single.sh 
#!/bin/sh
xrandr --output LVDS1 --mode 1024x600 --pos 0x0 --rotate normal --output VGA1 --off
lxpanelctl restart

~/.screenlayout$ cat dual.sh 
#!/bin/sh
xrandr --output LVDS1 --mode 1024x600 --pos 0x0 --rotate normal --output VGA1 --mode 1920x1080 --pos 1024x0 --rotate normal
lxpanelctl restart

adding the string "lxpanelctl restart" by hand (ARandR doesn't do it). Then, in the file
~/.config/openbox/lxde-ec.xml
I added the following lines between two </keybind> lines:


Code:
  </keybind>
  <keybind key="W-2">
  <action name="Execute">
  <command>sh ~/.screenlayout/dual.sh</command>
  </action>
  </keybind>
  <keybind key="W-1">
  <action name="Execute">
  <command>sh ~/.screenlayout/single.sh</command>
  </action>
</keybind>

so that using <super(windws)><1> and <super(windws)><2> I can switch between single and dual monitor configuration.

I hope this will be useful for others!

martes, 12 de abril de 2016

Anomenar fitxers correlativament

Tenim una carpeta amb fitxers a.png, bbbb.png cc-cccc.png i volem tenir-los com a 001.png, 002.png, 003.png

#!/bin/bash

i=1;
for file in *.png
do
  a=$(printf "%03d" $i)
  echo "$file" "$a.png"
  mv "$file" "$a.png"
  ((i++))
done

lunes, 11 de abril de 2016

PDF que no es mostra correctament (non-embedded fonts)

Un fitxer pdf no es mostra correctament perquè hi ha una font que no està embedded. Amb aquesta ordre ghostscript pot reparar el fitxer. Una explicació molt acurada, aquí.


gs -o repaired_file.pdf -dPDFSETTINGS=/prepress -sDEVICE=pdfwrite file.pdf

viernes, 8 de abril de 2016

Eines mikrotik

Safe mode

Safe mode is entered by pressing [CTRL]+[X]. To save changes and quit safe mode, press [CTRL]+[X] again. To exit without saving the made changes, hit [CTRL]+[D]