Sometimes pdf presentations rely on specific fonts, etc which may be unavailable on some computers.
Sometimes, a given pdf is very slow to show up on certain computers.
A solution can be to convert everything to bitmaps. This increases file size but makes rendering straightforward. With a trick that keeps the png format on the resulting pdf, the results are as crisp as in the original
#!/bin/bash
# Convert PDF file to individual pdf files with given resolution (96 DPI)
# without losing definition.
NPAGES=$(pdfinfo $1 | grep Pages | awk '{print $2}')
echo $NPAGES
for i in $(seq $NPAGES); do
echo Processing page $i
echo Generating "__FILE$i".pdf
pdftk A=$1 cat "A$i" output - | convert -density 96 - png:- | img2pdf -o "__FILE$i".pdf -
# ^ ^ ^ ^
# | | | lossless conversion to pdf
# | | specify PNG
# | convert to png
# extract page
done
# The last part comes from
# https://unix.stackexchange.com/questions/42856/how-can-i-convert-a-png-to-a-pdf-in-high-quality-so-its-not-blurry-or-fuzzy
viernes, 24 de abril de 2020
lunes, 22 de abril de 2019
Recover deleted files
Scenario: you had some files on your USB stick which you need to recover.
The tool to use is PhotoRec.
sudo apt install testdisk
sudo photorec
A guide is here.
lunes, 26 de febrero de 2018
Combining multiple pdf files
To combine multiple pdf files into a single one, use
pdftk A=doc1.pdf B=doc2.pdf C=doc3.pdf cat A1-9 B C A10-end output global.pdf
pdftk A=doc1.pdf B=doc2.pdf C=doc3.pdf cat A1-9 B C A10-end output global.pdf
sábado, 16 de septiembre de 2017
Extract page from pdf and convert to png
Extreure la pàgina que volem:
$ pdftk Caminant.pdf cat 1 output p1.pdf
Convertir-ho al que convingui, aquí en jpg
$ convert -units PixelsPerInch -density 300 p1.pdf p1_300.jpg
Si volem extreure totes les pàgines:
$ pdftk Caminant.pdf burst
Això ens crea un fitxer pg_xxxx.pdf per cada pàgina i un fitxer resum del que hi havia al pdf original
Ara, per convertir totes les pàgines de cop, podem fer:
for file in pg_*.pdf ; do convert -units PixelsPerInch -density 300 "$file" "${file%.*}.jpg" ; done
Combinació de pdftk i de convert en una línia:
$ pdftk A=filein.pdf cat A14 output - | convert -density 96 - fileout.png
Els guions substitueixen els noms que hi hauria:
- A pdftk faríem ... output output.pdf.
- A convert faríem convert ... filein.pdf fileout.png
Aquí es fa a 96 dpi, però es pot fer a més resolució, si interessa.
$ pdftk A=POG.pdf cat A14 output - | convert -density 96 - - | convert - pag14.pdf
Això es pot fer automatitzat
NPAGES=$(pdfinfo $1 | grep Pages | awk '{print $2}')
echo $NPAGES
for i in $(seq $NPAGES); do
echo Processing page $i
echo Generating "FILE$i".png
pdftk A=$1 cat "A$i" output - | convert -density 96 - "__FILE$i".png
done
domingo, 4 de junio de 2017
Octave: Fit Gaussian to data
% Adjust a gaussian
% Define the gaussian function
gausFun = @(hms,x) hms(1) .* exp (-(x-hms(2)).^2 ./ (2*hms(3)^2)) ;
init=[100;0;20]; % Hmax, mean, sigma
[P, FY, CVG, OUTP] = nonlin_curvefit (gausFun , init', XX, NN);
%Print estimated sigma
sigma_est=P(3)
viernes, 28 de abril de 2017
Raspberry pi zero W
Enable headless operation
- Download raspbian and write to micro-SD card
- Mount on PC and, on the boot partition:
- Create an (empty) file called ssh (this enable SSH on startup)
- Create a wpa_supplicant.conf file with the following content
network={
ssid="YOUR_WIFI_SSID"
psk="YOUR_WIFI_PASSWORD"
key_mgmt=WPA-PSK
}
On Off button
Poweroff
To poweroff, follow these instructions:
Essentially:
Connect button between GPIO18 and GND
Write this python script
- #!/bin/python
- # Simple script for shutting down the raspberry Pi at the press of a button.
- # by Inderpreet Singh
- import RPi.GPIO as GPIO
- import time
- import os
- # Use the Broadcom SOC Pin numbers
- # Setup the Pin with Internal pullups enabled and PIN in reading mode.
- GPIO.setmode(GPIO.BCM)
- GPIO.setup(18, GPIO.IN, pull_up_down = GPIO.PUD_UP)
- # Our function on what to do when the button is pressed
- def Shutdown(channel):
- os.system("sudo shutdown -h now")
- # Add our function to execute when the button pressed event happens
- GPIO.add_event_detect(18, GPIO.FALLING, callback = Shutdown, bouncetime = 2000)
- # Now wait!
- while 1:
- time.sleep(1)
- sudo nano /etc/rc.local
- sudo python /home/pi/Scripts/shutdown_pi.py &
Poweron
To poweron, place a button across the RUN header of the RPI zero. This is actually a reset button but when halted can bring the Pi on again.
Power Consumption
During boot, I have seen peaks of 240 mA.
After shutdown, power consumption is 30 mA.
sábado, 25 de marzo de 2017
SPICE with Python
PySpice seems to be a great tool!
Just do
git clone https://github.com/FabriceSalvaire/PySpice
and install everything that it needs:
PySpice requires the following dependencies:
The way to organize a project is to have the file.py, a folder called libraries and inside put folders with the element.lib files. These can also be put into folders to easily organize things. Then, call this
libraries_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'libraries')
spice_library = SpiceLibrary(libraries_path)
circuit.include(spice_library['2n2222a'])
circuit.BJT(1, 'collector', 'base', circuit.gnd, '2n2222a')
Resistor
circuit.R( name, +node, -node, value)
circuit.R(1, 'out', circuit.gnd, kilo(5))
Capacitor
circuit.C(1, +node, -node, value)
circuit.C(1, +node, -node, value, initial_condition=5)
BJT
circuit.BJT(1, 'collector', 'base', circuit.gnd, '2n2222a')
Results
analysis.base : the voltage of node named 'base'
Interesting features
https://github.com/FabriceSalvaire/PySpice/blob/gh-pages/downloads/voltage-divider.py
Shows how to put a voltage source defined in Python into Spice. This probably means that you can have an arbitrary function generator in Python!!!
Just do
git clone https://github.com/FabriceSalvaire/PySpice
and install everything that it needs:
PySpice requires the following dependencies:
- Python 3
- Numpy
- Matplotlib
- Ngspice
- CFFI (only required for Ngspice shared)
The way to organize a project is to have the file.py, a folder called libraries and inside put folders with the element.lib files. These can also be put into folders to easily organize things. Then, call this
libraries_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'libraries')
spice_library = SpiceLibrary(libraries_path)
circuit.include(spice_library['2n2222a'])
circuit.BJT(1, 'collector', 'base', circuit.gnd, '2n2222a')
Resistor
circuit.R( name, +node, -node, value)
circuit.R(1, 'out', circuit.gnd, kilo(5))
Capacitor
circuit.C(1, +node, -node, value)
circuit.C(1, +node, -node, value, initial_condition=5)
BJT
circuit.BJT(1, 'collector', 'base', circuit.gnd, '2n2222a')
Results
analysis.base : the voltage of node named 'base'
Interesting features
https://github.com/FabriceSalvaire/PySpice/blob/gh-pages/downloads/voltage-divider.py
Shows how to put a voltage source defined in Python into Spice. This probably means that you can have an arbitrary function generator in Python!!!
domingo, 5 de febrero de 2017
Coses sobre l'esquena i els isquiotibials
https://breakingmuscle.com/learn/2-overlooked-reasons-your-hamstrings-are-tight
https://breakingmuscle.com/learn/cant-touch-your-toes-find-and-fix-the-root-of-the-problem
https://breakingmuscle.com/learn/are-your-weak-neck-muscles-making-your-hamstrings-tight
viernes, 3 de febrero de 2017
Arduino. On és el main?
Exactament què fa un programa en Arduino?
Executa un loop com aquest: https://github.com/arduino/Arduino/blob/master/hardware/arduino/avr/cores/arduino/main.cpp
int main(void) {
init();
initVariant();
setup();
for (;;) {
loop();
if (serialEventRun) serialEventRun();
}
return 0;
}
Executa una vegada el setup de client i crida repetidament loop() més serialEventRun.
Tot el codi principal està aquí https://github.com/arduino/Arduino/tree/master/hardware/arduino/avr/cores/arduino
Un element important és Arduino.h (en les versions "modernes" de Arduino).
jueves, 2 de febrero de 2017
Flight Controller
One of the best tutorials I have found on flight controllers
http://blog.owenson.me/build-your-own-quadcopter-flight-controller/
http://blog.owenson.me/build-your-own-quadcopter-flight-controller/
sábado, 7 de enero de 2017
Python debugging
Install interactive debugging
sudo -H pip install ipdb
To debug a script in ipython
that uses parameters in its call:
ipython -m ipdb './xvalues.py' -- -d TUB
The parameters for the script are passed after "--"
Once you have the shell, the useful commands are:
Useful link
https://pythonconquerstheuniverse.wordpress.com/2009/09/10/debugging-in-python/
sudo -H pip install ipdb
To debug a script in ipython
that uses parameters in its call:
ipython -m ipdb './xvalues.py' -- -d TUB
The parameters for the script are passed after "--"
Once you have the shell, the useful commands are:
- n "next"
- <ENTER> repeats the last command
- p "print" p variable
- s "step into"
- b "breakpoint" b. This can be interesting: break at line 25: b 25. Break when method x of object y is called b y.x
- r "continue to end of subroutine"
- c "continue till the end"
Useful link
https://pythonconquerstheuniverse.wordpress.com/2009/09/10/debugging-in-python/
viernes, 6 de enero de 2017
What to do if Ubuntu freezes?
https://askubuntu.com/questions/4408/what-should-i-do-when-ubuntu-freezes
domingo, 4 de diciembre de 2016
List of packages that have been installed in Ubuntu
From http://unix.stackexchange.com/questions/288024/how-can-i-get-a-list-of-packages-that-i-have-installed-using-apt-get
This will give you a list of packages that have been installed, in the order that they were installed:
zgrep -h ' install ' /var/log/dpkg.log* | sort | awk '{print $4}'
However, only the last 12 months of
/var/log/dpkg.log* files are kept by default. To change this, edit /etc/logrotate.d/{apt,dpkg}. For example, change rotate 12 to rotate 1200 to keep the last 1200 months (100 years) worth - effectively forever, never delete the old logs. Use
dpkg to list all packages installed on a system: dpkg --get-selectionsballlalalala
viernes, 18 de noviembre de 2016
Negative scanning with a DSLR camera
From https://www.flickr.com/groups/canondslr/discuss/72157620448786604
Well, I've archived over 500 shots this weekend and it's working really well. Since you asked, here's exactly how I did it :-)
* Tripod with legs barely extended, splayed wide for stability so the camera body is only about 40cm off the ground. Fully-adjustable ball head and/or horizontal centre column. I use a Manfrotto 190 with standard rubber feet.
* DSLR with a macro lens with 1:1 capability - or near enough - pointing straight down (use a spirit level on the screen.)
* Lightbox - I got a tiny lightbox (size of a small paperback book) from the clearance bin at Jessops in London. I chose a small one for cost (didn't want to waste much money on an experiment) and the fact that my apartment is small and cluttered. In fact, the box's small size turned out to be an asset during shooting, as you'll see.
As I was set up on the wooden floor, I needed so sit on the floor for extended periods so a cushion was necessary :-) If you can set up on a low coffee table so that it's comfortable to sit on a chair while you peer through the viewfinder then that may be a better solution. Don't set up on a carpet or rug - you need a hard, smooth surface. Also remember to set up somewhere fairly shady and without overhead lighting. Reflections from the surface of the lightbox or negative will ruin the shot.
Here's how it looked:

* Fiddle endlessly with the tripod to get the focus and framing exactly right - you want to capture the full frame plus a little of the surrounding area. Without a little room to maneuvre you'll spend ages framing each shot to avoid slicing off bits of the frame. If you have a lot of negatives to get through you'll regret it. On the other hand, the more megapixels you have in the actual negative the better the resolution. With ISO 100 consumer colour print film I found the grain to be quite a bit bigger than the pixels on my 8MP 20D, so a 10% margin all round was fine. This part is tedious but crucial. I used my trusty old 20D so that it could be left set up for a few days without interfering with my normal shooting. If you only have one camera body then make sure you have a quick-release plate so you don't have to fiddle with the tripod or head between sessions, it'll drive you crazy. Failing that, or if you can't leave the tripod set up in between sessions, measure the leg extensions and head height and make notes so they're easier to replicate later.
* Focus on a negative, switch to manual focus and tweak until you're sure it's a sharp as possible.
* Set the ISO to 100 and take some shots of blank and non-blank negatives to determine the required exposure very carefully. You want to 'expose to the right' but without any possibility of blown highlights in the negative itself. Some/most of the sprocket holes will blow out (and flash during histogram review) if you're doing it right. Bear in mind that the base colour of different films varies quite a lot, so be cautious and do your experimentation on one of the lightest films you have - Agfacolour for example is a light lilac colour, whereas some of the Kodacolour films are a deep orange. You won't have the patience to check the histogram with every shot, and blown highlights are impossible to recover. On the other hand, I suppose, they translate to 'blown blacks' so the effect isn't disastrous - you'll probably find the dark parts of the shot pretty ugly anyway if you've got used to digital. Anyway, I digress. Once you've calculated the correct exposure, use manual mode with the aperture on the lens set to f/8-f/16. The shutter speed will work out somewhere between 1/10 and 1s unless you have a weird lightbox. You need the small aperture for decent depth of field - some negatives are a bit curved and although you can reduce that by flattening the frames either side you risk scratching them and will slow yourself down. The curvature's correctible in post processing, unless it's really extreme. Flattening with a glass sheet, by the way, is not recommended. Not only do you reduce contrast and risk scratches, you also risk interference patterns ('Newton's rings') from the trapped air layer, which are really ugly.
* Set capture mode to Raw+smallest jpg.
* Take a shot of a blank neg and set the white balance to 'custom' and use this as the reference point. It doesn't matter for the raw shot but the thumbnail jpgs will look nicer 'out of the box'.
* If you haven't worked with film for a while I should remind you of the vulnerability of negatives to scratches and fingerprints. Individual shots can also be messed up by dust and hairs and you might not see them throught the viewfinder. Keep a rocket blower handy, keep your gear clean and wash & dry your hands regularly. Cool clothing helps reduce hand sweat too.
* Set 'Mirror Lockup' to ON in your Custom Functions menu and set the drive mode to Self Timer. On my 20D it defaults to a 2s delay which is perfect.
* Try to get the orientation of the neg strip correct before shooting. It's not much effort to flip/rotate the files on the computer but it's almost zero to get it right first time.
* Shoot a whole film and then go to the computer and do your final checks for highlights, pixel-peeping for sharpness (i.e. focus and/or shake). During shooting I found positioning the negatives to be fairly easy if I just dropped the strips onto the light box 'any old how' and then fine-tuned the position by moving and rotating the lightbox itself. It's much easier to be precise and avoids too much touching of the negative. This is the reason that a small lightbox is better - you don't want it knocking your tripod legs or needing two hands to move because you'll have one hand on the shutter most of the time. Try to ensure the edges of the negative and viewfinder frames are close to parallel - rotating shots by a degree here and a degree there is a pain.
Here's an example jpg straight from the camera:

* On the computer, batch invert all the jpgs so you have 'thumbnails' that can be understood without the need for LSD, and leave the raw files alone. Resist the temptation to fiddle with the raw files before they've been properly archived and backed up.
* Be organised - shoot a whole film, then put the negs back in their sleeves and file them away in a separate place so they don't get mixed up with the yet-to-be-shot ones. Same goes for putting them in separate directories/folders on the computer. When you get in the groove you'll be churning through a 36-exp film every 3-4 minutes, so the shots quickly mount up. Shoot on two different memory cards so one is downloading while the other is being shot.
So, how to produce the finished article? Open up a raw file, invert it, adjust the exposure with reference to the histogram and then fix the colours, which will have a pronounced blue cast. I found the 'black dropper' (using the unexposed frame edge if necessary) and 'white dropper' to be sufficient for 95% of the shots, with only occasional recourse to more careful channel adjustment needed for some of my very oldest films.
Here is the finished product, processed from the raw file of the jpg above:

Beats paying money for a big slow scanner you might never use again (and fighting with crappy software, for that matter). Let me know if you have any questions, and feel free to add your own tips.
Well, I've archived over 500 shots this weekend and it's working really well. Since you asked, here's exactly how I did it :-)
* Tripod with legs barely extended, splayed wide for stability so the camera body is only about 40cm off the ground. Fully-adjustable ball head and/or horizontal centre column. I use a Manfrotto 190 with standard rubber feet.
* DSLR with a macro lens with 1:1 capability - or near enough - pointing straight down (use a spirit level on the screen.)
* Lightbox - I got a tiny lightbox (size of a small paperback book) from the clearance bin at Jessops in London. I chose a small one for cost (didn't want to waste much money on an experiment) and the fact that my apartment is small and cluttered. In fact, the box's small size turned out to be an asset during shooting, as you'll see.
As I was set up on the wooden floor, I needed so sit on the floor for extended periods so a cushion was necessary :-) If you can set up on a low coffee table so that it's comfortable to sit on a chair while you peer through the viewfinder then that may be a better solution. Don't set up on a carpet or rug - you need a hard, smooth surface. Also remember to set up somewhere fairly shady and without overhead lighting. Reflections from the surface of the lightbox or negative will ruin the shot.
Here's how it looked:

* Fiddle endlessly with the tripod to get the focus and framing exactly right - you want to capture the full frame plus a little of the surrounding area. Without a little room to maneuvre you'll spend ages framing each shot to avoid slicing off bits of the frame. If you have a lot of negatives to get through you'll regret it. On the other hand, the more megapixels you have in the actual negative the better the resolution. With ISO 100 consumer colour print film I found the grain to be quite a bit bigger than the pixels on my 8MP 20D, so a 10% margin all round was fine. This part is tedious but crucial. I used my trusty old 20D so that it could be left set up for a few days without interfering with my normal shooting. If you only have one camera body then make sure you have a quick-release plate so you don't have to fiddle with the tripod or head between sessions, it'll drive you crazy. Failing that, or if you can't leave the tripod set up in between sessions, measure the leg extensions and head height and make notes so they're easier to replicate later.
* Focus on a negative, switch to manual focus and tweak until you're sure it's a sharp as possible.
* Set the ISO to 100 and take some shots of blank and non-blank negatives to determine the required exposure very carefully. You want to 'expose to the right' but without any possibility of blown highlights in the negative itself. Some/most of the sprocket holes will blow out (and flash during histogram review) if you're doing it right. Bear in mind that the base colour of different films varies quite a lot, so be cautious and do your experimentation on one of the lightest films you have - Agfacolour for example is a light lilac colour, whereas some of the Kodacolour films are a deep orange. You won't have the patience to check the histogram with every shot, and blown highlights are impossible to recover. On the other hand, I suppose, they translate to 'blown blacks' so the effect isn't disastrous - you'll probably find the dark parts of the shot pretty ugly anyway if you've got used to digital. Anyway, I digress. Once you've calculated the correct exposure, use manual mode with the aperture on the lens set to f/8-f/16. The shutter speed will work out somewhere between 1/10 and 1s unless you have a weird lightbox. You need the small aperture for decent depth of field - some negatives are a bit curved and although you can reduce that by flattening the frames either side you risk scratching them and will slow yourself down. The curvature's correctible in post processing, unless it's really extreme. Flattening with a glass sheet, by the way, is not recommended. Not only do you reduce contrast and risk scratches, you also risk interference patterns ('Newton's rings') from the trapped air layer, which are really ugly.
* Set capture mode to Raw+smallest jpg.
* Take a shot of a blank neg and set the white balance to 'custom' and use this as the reference point. It doesn't matter for the raw shot but the thumbnail jpgs will look nicer 'out of the box'.
* If you haven't worked with film for a while I should remind you of the vulnerability of negatives to scratches and fingerprints. Individual shots can also be messed up by dust and hairs and you might not see them throught the viewfinder. Keep a rocket blower handy, keep your gear clean and wash & dry your hands regularly. Cool clothing helps reduce hand sweat too.
* Set 'Mirror Lockup' to ON in your Custom Functions menu and set the drive mode to Self Timer. On my 20D it defaults to a 2s delay which is perfect.
* Try to get the orientation of the neg strip correct before shooting. It's not much effort to flip/rotate the files on the computer but it's almost zero to get it right first time.
* Shoot a whole film and then go to the computer and do your final checks for highlights, pixel-peeping for sharpness (i.e. focus and/or shake). During shooting I found positioning the negatives to be fairly easy if I just dropped the strips onto the light box 'any old how' and then fine-tuned the position by moving and rotating the lightbox itself. It's much easier to be precise and avoids too much touching of the negative. This is the reason that a small lightbox is better - you don't want it knocking your tripod legs or needing two hands to move because you'll have one hand on the shutter most of the time. Try to ensure the edges of the negative and viewfinder frames are close to parallel - rotating shots by a degree here and a degree there is a pain.
Here's an example jpg straight from the camera:

* On the computer, batch invert all the jpgs so you have 'thumbnails' that can be understood without the need for LSD, and leave the raw files alone. Resist the temptation to fiddle with the raw files before they've been properly archived and backed up.
* Be organised - shoot a whole film, then put the negs back in their sleeves and file them away in a separate place so they don't get mixed up with the yet-to-be-shot ones. Same goes for putting them in separate directories/folders on the computer. When you get in the groove you'll be churning through a 36-exp film every 3-4 minutes, so the shots quickly mount up. Shoot on two different memory cards so one is downloading while the other is being shot.
So, how to produce the finished article? Open up a raw file, invert it, adjust the exposure with reference to the histogram and then fix the colours, which will have a pronounced blue cast. I found the 'black dropper' (using the unexposed frame edge if necessary) and 'white dropper' to be sufficient for 95% of the shots, with only occasional recourse to more careful channel adjustment needed for some of my very oldest films.
Here is the finished product, processed from the raw file of the jpg above:

Beats paying money for a big slow scanner you might never use again (and fighting with crappy software, for that matter). Let me know if you have any questions, and feel free to add your own tips.
On Macro Extension Tubes and Lenses
This is from http://photo.stackexchange.com/questions/36225/can-i-use-macro-extension-tubes-with-a-non-manual-lens:
|
|
I am new to macro extension tubes and I want to buy one but I don't
have a manual lens (one where I could change the aperture manually) so I
don't know if an extension tube would work with my lenses or not. Could
anyone help me out with this please?
Also there are macro tube ranging from $10 to more than $100. what is
the difference between the cheap ones and the expensive ones?
|
||||
|
2 Answers
|
Yes you can.
The more expensive extension tubes has camera-lens connections that let you control aperture. With the cheaper tubes you still have options:
|
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 '.'
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.
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
OpenVPN howto
- Download the
OpenVPNConfigFile.ovpn. Note that you can rename the file to anything you like. - Move the oven file to
/etc/openvpn cd /etc/openvpnfolder and entersudo nano yourserver.txt
Save and Closeyour_server_user_name your_server_passowrdsudo nano OpenVPNConfigFile.ovpn
Findauth-user-passand addyourserver.txtnext to it so that it becomes
This will allow you to skip entering your credentials everytime you start openvpn connectionauth-user-pass yourserver.txt- Rename
OpenVPNConfigFile.ovpntoOpenVPNConfigFile.conf
sudo mv OpenVPNConfigFile.ovpn OpenVPNConfigFile.conf sudo nano /etc/default/openvpn
UncommentAUTOSTART="all"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
Suscribirse a:
Entradas (Atom)