Tag Archives: tips

Fix off screen windows in Windows 10

Do you have windows which are stuck off screen and there is no Move options in the right click menu on the taskbar, even if you hold the Shift key? Read on for a solution!

  1. Left click the app’s icon on the taskbar icon. If the app has more than one window open, click on the appropriate thumbnail.
  2. Press and hold the Alt key on your keyboard then press the spacebar and release. This will bring up a menu on one of your visible screens.
  3. Click ‘Move’ on the list, and use the cursor keys (the arrow keys) on your keyboard to move the program. The window will continue move while the key is held down. The window will usually be to the left or right of the screen where the menu popped up, but you may have to experiment to see where it is to move it back.

That it! Good luck!

Swappiness in linux

Shamelessly stolen from wikipedia because they’re thinking about removing this, as  “Wikipedia is not a howto”. *sigh*.

 

With kernel version 3.5 and over, as well as kernel version 2.6.32-303 and over, it is likely better to use 1 for cases where 0 used to be optimal.

To temporarily set the swappiness in Linux, write the desired value (e.g. 10) to /proc/sys/vm/swappiness using the following command, running as root user:

# Set the swappiness value as root
echo 10 > /proc/sys/vm/swappiness

# Alternatively, run this
sysctl -w vm.swappiness=10

# Verify the change
cat /proc/sys/vm/swappiness
10

# Alternatively, verify the change
sysctl vm.swappiness
vm.swappiness = 10

Permanent changes are made in /etc/sysctl.conf via the following configuration line (inserted, if not present):

vm.swappiness = 10

10 is generally good for ‘I don’t want swapping to happen except if you *really* need it.

 

Varnish nsca logging on systemd system with x-forwarded-for

So, you have a Varnish server running systemd, which is behind a reverse proxy for SSL like nginx, and you can’t work out how to make varnishncsa log IP addresses from a specified header? Well, it’s a bit of a pain in the neck really. You need to override the systemd service file, which is like systemd’s version of the init scripts. Due to it being systemd, this is not just a case of editing a file…

For Debian, you can use the service file below, and paste it into
/etc/systemd/system/varnishncsa.service

Once done, you need to reload systemd’s service listing itself;
$ systemctl daemon-reload

Congratulations, you now have varnishncsa logs including the visitor’s real IP address, as specified by Nginx. Change the name in “{X-Forwarded-For}” to change the header name, for example if you want CloudFlare’s view of the client’s IP address, use “CF-Connecting-IP”

[Service]
 RuntimeDirectory=varnishncsa
 Type=forking
 PIDFile=/run/varnishncsa/varnishncsa.pid
 User=varnishlog
 Group=varnish
 ExecStart=/usr/bin/varnishncsa -a -w /var/log/varnish/varnishncsa.log -D -P /run/varnishncsa/varnishncsa.pid -F '%%{X-Forwarded-For}i %%l %%u %%t "%%r" %%s %%b "%%{Referer}i" "%%{User-agent}i"'
 ExecReload=/bin/kill -HUP $MAINPID

 

Arduino Variable Types Explained

Here’s something for reference.
I can never find just quite the succinct reference to Arduino Variable types. Nowhere could i find a list of minimum and maximum values, the bits, and the memory used by each variable type.

Neither was there any clear definition of meaning of ‘unsigned’, which just means no plus or minus signs in this type – that is all numbers positive. This increases the highest number that can be stored in the same memory. (thank me in the comments).

Usage Variable type Bits Min value Max value Ram usage Comments
common boolean 8 TRUE FALSE 1 byte
common byte 8 0 255 1 byte
char 8 -128 127 1 byte  A single ‘character’ e.g. ‘a’ is a single char.  Represented by chr(65) or the binary: 01000001
word 16 0 65535 2 byte
common int 16 -32768 32767 2 byte
unsigned long 32 0 4,294,967,295 4 byte
common long 32 -2,147,483,648 2,147,483,647 4 byte
common float 32 -3.4028235E+38 3.4028235E+38 4 byte
The below types are only included for compatibility or further study.
redundant unsigned char 8 0 255  1 byte use byte instead
redundant unsigned int 16 0 65535  2 bytes use word instead
redundant double 32 -3.4028235E+38  3.4028235E+38  4 bytes use float instead
The below types are special types (see arduino.cc)
special string variable  1 byte + x An array of chars
(used for storing strings to modify)
special enum variable  N/A Like boolean but custom fixed set of values allowed instead of TRUE/FALSE.
special struct variable  N/A Public sub variables
(as if you’d made a public class)
special pointer  N/A I’ll be honest, I wasn’t sure the use of this one. Here for completeness though!
Source: https://learn.sparkfun.com/tutorials/data-types-in-arduino
Source: https://playground.arduino.cc/Code/DatatypePractices
Remark: “Unsigned” means no negative sign. This increases the range of positive numbers available.
Remark: Unsigned variables that exceed their capacity roll over back to zero. This could be useful to iterate through arrays of limited length

PPS If anyone can figure out how to properly format this table so it looks nice, with ‘center’ aligned text, please let me know wordpress was being frustrating!

(The formatting css is in the source, see the table tag)

Find Windows workstation logon script

This is a super quick tip from an online forum…
[Sevenforums.com: Where is the location for the windows logon script?]

If you’re looking for the location of the active logon script in a Windows domain network on a workstation, or just to figure out which logon script is being used for a workstation

TLDR; ‘Get to the point, where is the bleeding thing?!’:

To find the location of a user’s logon script, while logged in as the user, run the command:
net user “%USERNAME%” | find “Logon script”
or for a domain user,
net user “%USERNAME%” /domain | find “Logon script”

Standard location

The logon scripts themselves can be found on the network in the standard domain network share location:

\\%USERDOMAIN%\netlogon

Additionally, the commands:

net user “%USERNAME%” /domain

and

gpresult /r

Give interesting results for the current user and what Group policy rules are active for the currently logged in user/(machine?) respectively.

Obviously this is only relevant to windows computers in active directory with primary domain controller and group policy ordaining that each machine should run a logon script.

 

Search Terms:

Things i searched for in order to try and find this out:

  • find out what logon script a computer is using
  • find path of logon script from workstation
  • find path of logon script from workstation registry

(I couldn’t find the registry location as it turns out!)

If this post helped you, or you have additional tips, please leave them in the comments!

Excel tip – adding two numbers where one is text

Just a quick tip as i couldn’t quickly find the answer in google.

If you have two cells of data and you want to add them when one might have text instead of a number, use the SUM function.

For instance

Class Section 1
QTY
Section 2
QTY
Totals
Robots 10,000 1,000 =sum(B2:C2)
=11,000
Humans 9,000,000,000 n/a =sum(B3:C3)
=9,000,000,000
Plants n/a n/a =sum(B4:C4)
=0

I also searched for: sum two values if isnumeric, excel add two numbers if text only include the non text and excel add two numbers if text.

R.A.O.K

An explanation more beautiful than my words could ever be:
Giving Is The Best Communication – Thai Mobile Ad…: http://youtu.be/JPOVwKPMG8o

The World full of horrible injustices, life is cruel and unfair. Survival of the fittest is now survival of the richest.

And the worst thing?
It feels like you’re just too powerless, poor or insignificant against the size if it.

Starvation, Cancer, HIV, Natural disasters whatever.

Well the truth is there is something you can do to change the world.

And its cheap, and simple and should make someone smile.

Its called A Random Act Of Kindness or RAOK.

Just do one small thing to improve the life of a stranger.
See that a Girl sobbing? Go give her a tissue.
Give your elderly neighbour a Christmas card or invite him round for a cup of tea.
Hold the door open for someone.
Carry a lighter just in case someone asks for a light.
Give out free hugs (I did this once. It was hugely fun. I made sure I got all the people with the saddest expressions 😉 ).

Have a think. Be good to people, even if you don’t know them.

Simple
Leave a note that says ‘pass it on’

Now you may never know the difference that a small random act of kindness makes to that stranger. But this is not about fame or fortune, its about changing the world one small random act of kindness at a time.

My hot tip? Why just one RAOK?

Share the love.

And Dear stranger,
If you find this, pass it on, and have a brilliant week!
Sincerely,
Anon
(I know my name is on here, but who I am doesn’t matter. Thank me by doing a RAOK and asking them to pass it on 😉 )

Link

Just a super-quick post here.

If you’re looking for addons or plugins for Microsoft Outlook to help you organize your emails and extend the functionality of Outlook

(note Outlook is very extensible, as with all Microsoft Office applications you can write Visual Basic code for Applications to hook into it’s functions. Absaloutely fantastic for hacking excel as I have been doing for the last few weeks – my work needs to invest in a proper database program for sure *sigh*)

You’d do no better than looking here

Snapfiles Outlook Add-ons

http://www.snapfiles.com/freeware/comm/fwoutlook.html

 

They have addons that are useful – and unlike most of the sites on i’ve found so far – up to date and compatible with recent versions (2003+) of Outlook.

Hope this helps folks!

 

[UPDATED]Useful Firefox addons

2009 vs 2013 Useful Firefox [Browser] Addons

Originally I wasn’t really into add ins then i got into trying loads of add ins and eventuallyi have whittled it back to the few firm favourites/favorites for the americans.
[i was going to del fav bit but then I noticed that my firefox dictionary is still set to US because of it (which is what happened back in 2009 too haha)

ubiquity beta addon for firefox – run, send email, new calendar event, update twitter.
have not tried this yet. Read about it here:
http://www.ghacks.net/2008/08/26/mozilla-labs-ubiquity-is-a-firefox-killer-application/
or at mozzy labs: http://labs.mozilla.com/2008/08/introducing-ubiquity/
[2014 Ubiquity has died, but you can still install the addon (download using the bitbucket link)]: https://addons.mozilla.org/en-US/firefox/addon/mozilla-labs-ubiquity/

Favourites/remember this website

Tag sifter

Taboo – one click remember this, timeline

Readitlaterlist.com Now Getpocket.com – my cuurent fav  [2014: Still using it today]

Foxmarks

Tabs

Duplicate tab

Tab kit [Plus]- organizer of tabs

[2014 I haven’t used this in a while]

[New for 2013: Firefox: TooManyTabs                                            https://addons.mozilla.org/en-US/firefox/addon/toomanytabs-saves-your-memory]

Testing this one right now!

[2014 Tab Manager]

Awesome enables Tabs of Tabs (another tab bar above so you can group tabs into projects, subjects etc)
however not available for latest firefox and the other versions are buggy/not working. 🙁

[New for 2014: Chrome: OneTab                           http://www.one-tab.com/ ]                           

There really is one tab to rule them all!Fold all open tabs down to one and free all that memory. Edit what’s ‘open’, leave it just as a single tab, or reopen (one by one or all).

I NEED to test this one when I switch back to Chrome!

Session Manager – protector and saver of tabs! [2014: integrated session managers are pretty comprehensive now!]

 

Download Them All

[2014:Still very useful last time I used it a few years ago, but internet speeds have increased monumentally since 2009, so much so that download managers are not needed for that anymore. It’s still a brilliant tool for downloading all images from a page for example]

grub-probe: error: no such disk

Ran into this one today, on a debian squeeze box:

/usr/sbin/grub-probe: error: no such disk.

It actually was telling the truth, the disks listed in /boot/grub/device.map were wrong. Replaced /dev/disk/by-id/serial-of-drive with /dev/sda. Worked.

Whilst researching this problem, I did run into a similar debian bug, but it wasn’t relevant. In case you’re interested, it’s about LVM drives, and it’s here: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=673573