C sharp (C#) Hello world

create a cs file hello-world.cs and add code.

run the file in cmd
C:\Desktop> C:\Windows\Microsoft.NET\Framework64\v3.5\csc.exe hello_word.cs

then a executable will be created called hello_word.exe. That is your program. Run that to run you program.

Fixing ethernet network connection

Issue: When plugin in the Ethernet cable to computer would be not have a connection.
Reason: Ethernet driver is not installed, corrupted or out of date.
motherboard: Asus z97-AR
Intel CPU: Intel Core i7-4790K
operating system: Window 7

Fix:
Go to device manager.
Under ‘Other devices’ the Ethernet Controller has a warning icon

donwload then extract ‘Turbo LAN V1.04.01 for Windows 7/8/8.1 32bit & 64bit.’ driver from asus site

In device manager right click on ‘Ethernet Controller’ then ‘Update Driver Software’ then ‘browse my computer for driver software’
Browse to the extracted folder ‘Intel_LAN_Win7-8-8-1_VER191510’ then click next

Restart computer

Mount usb linux command line

# ways to find flash drive
dmesg | tail
sudo fdisk -l
lsusb
ls /dev/sd*

# make a directory to mount the usb
sudo mkdir /media/usb

# mount usb
# to grant permission to all when mounting add umask flag. For only root omit flag.
sudo mount -o umask=000 /dev/sda1 /media/usb

# if error mount: unknown filesystem type 'exfat'
sudo apt-get install exfat-fuse exfat-utils

# mount on every boot
# determine the partition/filesystem type for proc column
sudo blkid /dev/sda*

# edit file
sudo nano /etc/fstab

proc            /proc           proc    defaults          0       0
/dev/mmcblk0p1  /boot           vfat    defaults          0       2
/dev/mmcblk0p2  /               ext4    defaults,noatime  0       1
/dev/sda1       /media/usb      exfat   defaults
# a swapfile is not a swap partition, no line here
#   use  dphys-swapfile swap[on|off]  for that

# unmount
sudo umount /dev/sda1

# resources
How to Mount USB Drive on the Raspberry Pi

# tags
ntfs fat32 ext4

Samba Installation

Installing samba
$ sudo apt-get update
$ sudo apt-get install samba samba-common-bin
$ sudo nano /etc/samba/smb.conf

Configuration example

[global]
	netbios name = PI
	server string = The Pi File Center
	workgroup = WORKGROUP
	hosts allow =
	socket options = TCP_NODELAY IPTOS_LOWDELAY SO_RCVBUF=65536 SO_SNDBUF=65536
	remote announce =
	remote browse sync =

[homepi]
	path = /home/pi
	comment = No comment
	browsable = yes
	read only = no
	valid users =
	writable = yes
	guest ok = yes
	public = yes
	create mask = 0777
	directory mask = 0777
	force user = root
	force create mode = 0777
	force directory mode = 0777
	hosts allow =

# password protected
[fsq]
	comment = fsq
	path = /var/fsq
	browseable = Yes
	writeable = Yes
	only guest = no
	create mask = 0777
	directory mask = 0777
	public = no

Creating Samba User:
$ sudo smbpasswd -a pi
type password, press enter

Restart Samba Service:
$ sudo service smbd restart

Resources:

Sync server time and date

sudo service ntp stop
sudo ntpd -gq
sudo service ntp start

sources:
http://askubuntu.com/questions/254826/how-to-force-a-clock-update-using-ntp#answer-256004
https://www.digitalocean.com/community/tutorials/how-to-set-up-timezone-and-ntp-synchronization-on-ubuntu-14-04-quickstart
https://help.ubuntu.com/lts/serverguide/NTP.html

create git:// protocol

$ sudo apt-get install xinetd
$ sudo nano /etc/xinetd.d/git

# where highlighted if incorrect the service may not start

service git
{
        disable = no
        type            = UNLISTED
        port            = 9418
        socket_type     = stream
        wait            = no
        user            = nobody
        server          = /usr/bin/git
        server_args     = daemon --inetd --export-all --base-path=/var/fsq
        log_on_failure  += USERID
}

$ sudo /etc/init.d/xinetd restart
$ sudo /etc/init.d/xinetd status

# view the number of active services

active_services = 2
available_services = 2
descriptors_free = 1014
running_servers = 0
Logging service = enabled

# Now, all git repositories beneath /var/fsq will be available to anyone who asks.
# git clone git://[hostname]/my-repo.git
$ git clone git://baligena.com/my-repo.git

# sources
http://stackoverflow.com/questions/2538015/why-wont-git-daemon-serve-my-repository#answer-2539138

Installing Gitlab

Raspberry Pi

# login as root
$ sudo su

# follow gitlab installation for specified operating system
$ apt-get install gitlab-ce

# install web server
$ apt-get install nginx

# check log for errors. Port conflicts will be notified
$ cat /var/log/nginx/error.log

# change port if desired
$ nano /etc/nginx/sites-enabled/default

server {
        listen 81 default_server;
        listen [::]:81 default_server;

        # SSL configuration

# reconfigure gitlab
$ gitlab-ctl reconfigure

# change gitlab port to match nginx port
$ nano /opt/gitlab/embedded/service/gitlab-rails/config/gitlab.yml

  ## GitLab settings
  gitlab:
    ## Web server settings (note: host is the FQDN, do not include http://)
    host: gitlab.example.com
    port: 81
    https: false

.......

test:
  <<: *base
  gravatar:
    enabled: true
  gitlab:
    host: localhost
    port: 81

# change gitlab port to match nginx port
$ nano /etc/gitlab/gitlab.rb

## Url on which GitLab will be reachable.
## For more details on configuring external_url see:
## https://gitlab.com/gitlab-org/omnibus-gitlab/blob/master/doc/settings/configuration.md#configuring-the-external-url-for-gitlab
external_url 'http://gitlab.com.local:81/'

........

## Advanced settings
# unicorn['listen'] = '127.0.0.1'
# unicorn['port'] = 8081
# unicorn['socket'] = '/var/opt/gitlab/gitlab-rails/sockets/gitlab.socket'
# unicorn['pidfile'] = '/opt/gitlab/var/unicorn/unicorn.pid'

# reconfigure gitlab
$ gitlab-ctl reconfigure

# restart gitlab
$ sudo gitlab-ctl restart

# restart server
$ sudo reboot

# restart nginx
$ /etc/init.d/nginx restart

# check if listen to port
$ nmap -sS 192.168.0.14

PORT     STATE SERVICE
81/tcp   open  hosts2-ns
85/tcp   open  mit-ml-dev
443/tcp  open  https
3128/tcp open  squid-http
3389/tcp open  ms-wbt-server
9418/tcp open  git

# navigate to page. Be careful with browser cache (especially firefox)
http://192.168.0.14:81/

sources

http://www.thecfguy.com/blog/how-to-change-default-port-for-gitlab/

troubleshooting

# Reconfigure freezes at ruby_block[supervise_redis_sleep] action run
https://gitlab.com/gitlab-org/omnibus-gitlab/issues/430#note_1308607
http://stackoverflow.com/questions/22328923/impossible-to-install-gitlab-on-ubuntu-12-04#answer-25785708

when accessing the file tab there was an ajax request that was loading a 500 error page.
Looked into the log by running
$ sudo gitlab-ctl tail
and found this error message

Errno::ENOMEM (Cannot allocate memory - /opt/gitlab/embedded/bin/git):
.......

Found out that not enough memory was being allocate. May be because its a raspberry pi and it has limited memory.
The solution was to reduce unicorn worker processes thus reducing the memory consumption.
$ nano /etc/gitlab/gitlab.rb

##################
# GitLab Unicorn #
##################
## Tweak unicorn settings.

# unicorn['worker_timeout'] = 60
unicorn['worker_processes'] = 1

# Deleting branches and committing changes (edit file) using GitLab hangs it
error: proxyRoundTripper: POST " failed with: "EOF"

The corresponding unicorn worker waits for the git hook to complete and can not serve other requests during this time. The hook uses the GitLab web API to check if the user is allowed to execute the requested git operation. Because I had unicorn running with only one worker, no other worker was available to serve the API request, thus resulting in a deadlock.
https://gitlab.com/gitlab-org/gitlab-ce/issues/13947

$ nano /etc/gitlab/gitlab.rb

unicorn['worker_processes'] = 2

# remove GitLab
$ apt-get purge gitlab-ce

# remove nginx
$ apt-get purge nginx nginx-common nginx-full

Use apache server instead of nginx

followed these these steps

# Additional
Before running 'gitlab-ctl reconfigure', first run 'gitlab-ctl start postgresql', else there will be an error that postgresql is not running.

# enable apache modules
# http://stackoverflow.com/questions/25785903/gitlab-7-2-1-with-apache-server-instead-of-nginx#comment-65475363
# http://askubuntu.com/questions/64454/how-do-i-enable-the-mod-rewrite-apache-module-for-ubuntu-11-04#answer-64460
$ sudo a2enmod rewrite
$ sudo a2enmod proxy_http

If you get permission errors like "You don't have permission to access /assets/logo-white-0b53cd4ea06811d79b3acd486384e047.png on this server." then you need "Require all granted" in the <Location> in your apache vhost configuration file

# sources
http://stackoverflow.com/questions/25785903/gitlab-7-2-1-with-apache-server-instead-of-nginx#answer-25809733