Saturday, 19 August 2017

Useful git commands

Ty Walls has an excellent collection of git commands for reviewing git history and troubleshooting.

https://tygertec.com/find-stuff-git/

Friday, 18 August 2017

Using GIT from a network share

Running git on a remote network share, even when you have a good connectivity, is painful and slow.

It turns out someone clever has a better approach to using git in this use case.

http://www.watkyn.com/blog/2011/09/22/Using-git-at-work-on-a-Windows-network-drive/

Sunday, 30 July 2017

Type errors when using VLOOKUP

When using VLOOKUP it will only find matches of the same data type as source.

The link below has some solutions;

https://exceljet.net/formula/vlookup-with-numbers-and-text

TL;DR,

=IFERROR(VLOOKUP(id,planets,3,0),VLOOKUP(id&"",planets,3,0))

Sunday, 9 July 2017

Useful Docker and LXD info

Documentation

Developer documentation of using docker inside LXD
There are problems using docker inside LXD, many applications cannot run inside a LXD, this can in part be mitigated by applying the docker profile provided by LXD but this does not work for many applications.

Good example of bridging containers onto LAN, including setting up static ip's

Start container at boot time

Snippets

  • #!/bin/bash
  • # Delete all containers
  • docker rm $(docker ps -a -q)
  • # Delete all images
  • docker rmi $(docker images -q)

Sunday, 9 October 2016

Use OLE DB (Excel Spreadsheet) in SSRS

I have been learning a lot of SSRS and SQL server recently and have wondered how to apply the awesome toolset of SSRS to some other problems I have found.

From most of the resources I have found it is usually quoted that the only way to use excel as a datasource for SSRS is by adding the excel document as a ODBC, however in lots of environments that will not be possible due to security settings. 

In the back of my mind I was sure that I had seen excel used with OLE DB data source before. 

Finally I found an example of it working here;

Essentially you use the following connection string
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\MyExcel.xls;Extended Properties="Excel 8.0;HDR=Yes;IMEX=1";

and all works as hoped 




Success!

The only other point to make is that you need to reference the sheet name with a $ suffix,
SELECT
F1 AS rowNum
,F2 AS theValue
FROM
[Data3$]

More resources: 

I wish I found these earlier! 

Connection strings,
https://www.connectionstrings.com/excel-2007/

Stack exchange question about the same problem:
http://stackoverflow.com/questions/24499299/connecting-excel-2013-to-ssrs-2012-to-use-as-a-datasource



Monday, 8 August 2016

Regenerate TS3 priv key

If you need to regenerate the ts3 priv key you can start the server with a temp admin key using

ts3server_minimal.sh serveradmin_password=YourNewPassWord
(http://shawnhyde.com/post/2010/01/12/How-to-recover-serveradmin-access-of-teamspeak3ts3-server-after-system-reload)

Login with:
login serveradmin password

Then generate key with:
use 1 tokenadd tokentype=0 tokenid1=6 tokenid2=0

(https://freevps.us/thread-11350.html)

Friday, 12 February 2016

Checksums in Windows

For a while I have been meaning to find a good checksum tool that I can use within windows but have gotten around to doing it properly.

SuperUser to the rescue:
http://superuser.com/questions/166233/is-there-a-built-in-method-for-computing-an-sha-1-or-md5-hash-in-windows-7
http://superuser.com/questions/245775/is-there-a-built-in-checksum-utility-on-windows-7

These led me to this:
http://code.kliu.org/hashcheck/

There is another alternative named HashTab but after reading this and looking at each of the options I ended preferring the look of Hashcheck.



Saturday, 5 July 2014

Thursday, 19 June 2014

ARMA 3 List of Squad Commands

I went looking for a list of ARMA 3 squad commands and couldn't find one, so here is my list. 

Quick Menu
·         Move/Engage
·         Stop/Regroup
·         Hold/Open Fire
·         Team
·         Support
·         Supports

1        Move
1-1   Return to formation
1-2   Advance
1-3   Stay Back
1-4   Flank Left
1-5   Flank Right
1-6   Stop
1-7   Wait for me
1-8   Find cover
1-9   Next waypoint


2         Target
2-1  

3        Engage
3-1   Open Fire
3-2   Hold Fire
3-3   Fire
3-4   Engage
3-5   Engage at Will
3-6   Disengage
3-7   Scan Horizon
3-8   Watch Direction
3-9   Suppressive Fire

4        Mount
4-1  

5        Status
5-1   Call Suport
5-2   Fuel Low
5-3   Ammo Low
5-4   Injured
5-5   Report Status
5-6   I'm under fire
5-7   Ne Less
5-8   … is down


6        Action
6-1 

7        Combat Mode
7-1   Stealth
7-2   Combat
7-3   Aware
7-4   Relax
7-5   Stand Up
7-6   Stay crouched
7-7   Go Prone
7-8   Copy my stance

8        Formation
8-1   Collumn
8-2   Stagger Col.
8-3   Wedge
8-4   Echelon L
8-5   Echelon R
8-6   Vee
8-7   Line
8-8   File
8-9   Diamond

9        Assign
9-1   Assign Red
9-2   Assign Green
9-3   Assign Blue
9-4   Assign Yellow
9-5   Assign White

10    Reply
10-1           Done
10-2           Negative
10-3           Ready to fire
10-4           Connot Fire
10-5           Repeat
10-6           Copy
10-7           Supports
10-8           Custom
10-9           Radio


Wednesday, 4 June 2014

Adobe Reader Split View

If you ever need to view several pages of a adobe document simultaneously (such as references and main body at the same time), you can do so by selecting Window-->New window

You can then arrange these as you want using your normal window manager.

Job done!


Monday, 2 June 2014

Get Zotero to exclude references from wordcount

If you are in the position where you need to manage a large amount of references or journal articles Zotero cannot be beaten, its a fantastic tool!

However when using it to manage references in a word document the wordcount shown at the bottom of the screen is incorrect as it counts the long string that word uses to store the reference.

The solution is to highlight the text you are interested in and press Control+Shift+G

Job Done!

Credit goes to: https://forums.zotero.org/discussion/22533/ms-word-word-count-issues/

Friday, 2 May 2014

Find corrupted video files

After some problems with corrupted video files that would not play I found this command;

find -size +100M -exec file '{}' ';' |grep ": data"

That allows you to quickly find files that are not recognised as video files and you can then delete or fix as needed.

File is an incredibly versatile on linux and can be used to identify all sorts of filetypes, in this case I use it to find files of filetype "data", basically file's way of saying it doesnt recognise the file.

Happy hunting!

Friday, 17 January 2014

Setting up bidirectional sync for Outlook and Google Calendar

It seems Google is trying to make it difficult to sync Google calendar and outlook when they discontinued their Google calendar sync.

However there are still install files around in the wild and the sync still works so if you get it installed it all still works - for now.

Download link: 
http://google-calendar-sync.en.softonic.com/download

Source link: 
http://www.ablebits.com/office-addins-blog/2013/11/20/sync-google-calendar-with-outlook/#google-apps-sync

Also if it doesn't seem to like two stage authentication - instead setup an app specific password instead and it works fine!

Happy syncing!

Saturday, 30 November 2013

EyeFi Mobile X2 will not connect to Wifi

So new EyeFi card will not connect to my router with the error message "waiting for a network address", after some investigation the logfile shows this:

eyefi AssocResp: Error status 0x0002, aid: ffff, error/cap: 0xfffc (Auth response timeout)

Which according to this site http://forums.eye.fi/viewtopic.php?f=2&t=3347 can indicate a faulty card reader, I plugged the reader directly into my USB port and hey-presto. Everything worked.

Wednesday, 28 August 2013

ARMA 3, probability of presence for group


I recently wanted to create a group of units based on probability; so 50% of the time spawn a group of units at a certain position.

To do this create the group, set the probability of presence of the leader to your desired probability and then for each member of the group set a condition of presence that requires the leader to be present. So,

(alive group_leader);

Job done!



Edit - Added screenshots for clarity:

You can have as many units as you want, in this example I have a player (blue), a group leader (purple civillian in front), and 4 dependent civilians behind. Ordinarily you would have all these units grouped using the group tool (F2) so they work as a team but it is not required.
Units
 Group leader can be configured any way you want, what is required is to have a unique name (make a note of this) and to set a probability of presence (which will set the probability of the whole group spawning).

Group leader config

 Now onto setting up the dependent units. A unit will spawn when the expression in its condition of presence evaluates to true. In this case we want it to evaluate to true when the group leader is present. The syntax for this is
(alive group_leader);
making sure that group_leader is the name of the leader that you configured earlier.
Dependent unit config

Tuesday, 23 July 2013

Windows disk usage analysis

Having just started using windows much more frequently I needed to work out what was hogging all my disk space, this tool 


Did the job nicely and found a good 40Gb of crap that can be deleted. Result! 

Wednesday, 13 March 2013

Remove unused kernels and headers from ubuntu server

Yet again I found my system clogged up with unused kernels and headers. This time I am making a note of the one-liner to remove the unused junk.

(Found at http://tuxtweaks.com/2010/10/remove-old-kernels-in-ubuntu-with-one-command/)

You can first check that the correct packages are selected to remove with;

 dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get --dry-run remove 

and if you are happy remove those with this;

dpkg -l linux-* | awk '/^ii/{ print $2}' | grep -v -e `uname -r | cut -f1,2 -d"-"` | grep -e [0-9] | xargs sudo apt-get -y purge


A word of warning, if you have installed a new kernel recently ensure you have rebooted since, and secondly ensure that your current kernel is not on the list of packages to remove of you will end up with a un-bootable system.

eth0 naming persistance

I needed to change the physical hardware for an instance of Ubuntu Server 12.04 after some hardware failed, although most of the hardware changes were seamless the network adapter name changed from eth0 to eth1, the fix for which I found here.

http://www.serenux.com/2009/11/howto-fix-a-missing-eth0-adapter-after-moving-ubuntu-server-from-one-box-to-another/

Essentially the udev rule found at

/etc/udev/rules.d/70-persistent-net.rules


Stores and makes persistent the names of the respective adapters.  By removing the line relating the that adapter is identified by such as

ACTION=="add", SUBSYSTEM=="net", SYSFS{address}=="00:a0:c9:78:9a:bc", NAME="eth0"




Subsequently the new adapter is then initialised with the name eth0.

Thursday, 21 February 2013

Logitech G500 mouse pointer jitter fix.

Logitech G500 Mouse jitter fix

So I brought a second hand Logitech G500 mouse which had some problems with jitter, when stopping the mouse quickly movement the pointer would briefly jitter a few pixels randomly.

After some googleing I found this blog entry - http://blog.ambor.com/2011/04/logitech-g500-mouse-rattle-jerky.html - which pointed me in the direction of the laser lens. Fixing the lens in place fixed the problem, the but as the original article has quite short on images I thought I would document it here. 

The top of the laser sensor, the lens is held in place by the two transparent tabs - which you can see passing through the black sensor at in the middle of the PCB.



The lens itself, this was unstable on my mouse and as the mouse moved/stopped the lens wiggled around disrupting the view of the laser.



 The laser sensor with blobs of glue fixing the lens's plastic tabs onto the sensor itself.



Job done!

Thursday, 29 November 2012

Combining multiple video files with mencoder


The following command can be used to combine several files into a single file,

mencoder -idx -oac copy -ovc copy -o output.avi input1.avi input2.avi 


Caveats:

  • Files must be the same resolution
  • Files must be encoded with the same codec (although different containers are ok)