Listing posts

Displaying posts 231 - 235 of 328 in total
SSH disable IPv6
mouse 1820 · person cloud · link
Last update
2018-07-25
2018
07-25
« — »

Add this line in /etc/ssh/ssh_config or ~/.ssh/config:

1
  AddressFamily inet

alternatively you can use the -4 command line switch.

You can set these options on command line too with the -o switch, eg: ssh -o AddressFamily=inet.


~~~ * ~~~

GitHub & BitBucket | convert repo from HTTPS to SSH
mouse 1757 · person cloud · link
Last update
2018-07-25
2018
07-25
« — »

Add you SSH public key to your account:

Then update the url setting on [remote "origin"] section in the .git/config file of your project :

1
2
3
4
5
# GitHub
url = ssh://git@github.com/USERNAME/PRJ_NAME.git

# BitBucket
url = ssh://git@bitbucket.org/USERNAME/PRJ_NAME.git

Source: GitHub, BitBucket


~~~ * ~~~

Git update all repos and branches
mouse 1508 · person cloud · link
Last update
2018-07-23
2018
07-23
« — »
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env ruby

Dir['*'].each do |prj|
  next unless File.directory?(prj) && File.exists?("#{prj}/.git")

  Dir.chdir(prj) do
    puts "\n#{'='*10}  #{prj}  ".ljust(70, '=')
    system "git co master"
    system "git fetch --all"

    branches = `git branch`.delete('* ').split("\n")
    branches_maxl = branches.map{|i| i.size }.max
    branches.each do |branch|
      puts "\n#{'~'*10}  #{branch.ljust branches_maxl}  ".ljust(40, '~')
      system "git co #{branch}"
      system "git pull"
    end

    puts "\n#{'-'*10}  (compacting)  ".ljust(40, '-')
    system "git co master"
    system "git gc"
  end
end

~~~ * ~~~

Convert CSV to XLS from cli
mouse 1350 · person cloud · link
Last update
2018-07-03
2018
07-03
« — »
1
2
unoconv -i FilterOptions=09,,system,1 -f xls input.csv # writes input.xls
unoconv -i FilterOptions=09,,system,1 -f xls *.csv     # convert all files

Source: Stackexchange, OpenOffice Filter_Options


~~~ * ~~~

rsync daemon mode
mouse 1901 · person cloud · link
Last update
2018-06-13
2018
06-13
« — »

On the server side create a rsyncd.conf config file:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# see "man rsyncd.conf" and /usr/share/doc/rsync/examples/rsyncd.conf
log file       = /path/to/rsyncd.log
pid file       = /path/to/rsyncd.pid
lock file      = /path/to/rsyncd.lock
address        = 192.168.1.123
reverse lookup = no

[folder_name]
  comment            = type a folder description
  path               = /path/to/shared_folder
  use chroot         = yes
  read only          = no
  list               = yes
  uid                = a_username
  gid                = a_usergroup
  strict modes       = no
  ignore errors      = no
  ignore nonreadable = no
  transfer logging   = no
  timeout            = 5
  hosts allow        = 192.168.1.0/255.255.255.0
  refuse options     = checksum
  dont compress      = *.gz *.tgz *.zip *.rar *.7z *.z *.rpm *.deb *.iso *.bz2 *.tbz

Then use these commands:

1
2
3
4
5
6
# server side: run daemon (ipv4 only)
rsync --daemon -4 --config=/path/to/rsyncd.conf

# client side
rsync -rdt rsync://ip_addr:port/                # list shared folders on server
rsync -avi rsync://ip_addr:port/folder_name/ ./ # sync folder from server

Source: atlantic.net