Cheat Sheet

Tuesday, February 7, 2017

Install GCC 5.3 on CentOS 7.3 with SCL

0 comments
Another way to enable GCC 5 just for current bash environment,

sudo yum install centos-release-scl
sudo yum install devtoolset-4-gcc*
scl enable devtoolset-4 bash
which gcc
gcc --version

and then, add this to enablegcc5.sh at /etc/profile.d

#!/bin/bash
source scl_source enable devtoolset-4

There you go

sudo cat > /etc/profile.d/gcc5-scl.sh << EOF
#!/bin/bash 
source scl_source enable devtoolset-4
EOF

Friday, February 3, 2017

Simple Advisory Lock for C# via Mono

0 comments
Mono handled mutex differently from Microsoft dotNET due to platform differences (eventhough the implementation is the same).

So the only simplest method to create mutex-like for advisory lock on mono is by creating a lock file. Criteria:

1. Only one instance of application can be run one time. (not to be confuse application with software and thread!)
2. After the application exit, the application can be run again. (Proper cleanup!)

Hence, this is the simple class for that.


https://gist.github.com/fawildchild/d1ccbf26af5931da6c138599ddd10de6

Straight forward I say.

(ps: Console.ReadKey() at the end)


Walla