jueves, 9 de marzo de 2023

Ubuntu 22.04 LTS (Jammy Jellyfish) on Macbook pro 2012

Steps:

  • Create a bootable USB stick
  • Insert the USB stick and power on holding down the “Option” key
  • Select the USB EFI Partition
  • Select Try and Install Ubuntu
  • Before installing, enable wifi. Open the terminal and run
    sudo apt install bcmwl-kernel-source
    magically it will recognize wifi networks
  • On the Desktop, click on Install Ubuntu
  • check "Download updates while installing Ubuntu"

Useful links:

  • install: https://www.lucaswilliams.net/index.php/2021/01/25/installing-ubuntu-20-04-2-on-macbook-pro-mid-2012/
  • wifi: https://www.reddit.com/r/Ubuntu/comments/ks2c4d/wifi_driver_help_on_a_macbook_pro_from_late_2012/
  • usb: https://discussions.apple.com/thread/253362747
  • ssd upgrade: https://www.youtube.com/watch?v=_PIrJAJtEK4

 

jueves, 30 de abril de 2020

vim in nocompatible mode

If the arrow keys make a mess (like typing A, B, C or D) in insert mode, try the nocompatible mode (-N) (makes vim work "Not fully Vi compatible"):

vi -N test.txt  

sábado, 7 de diciembre de 2019

bash autocomplete

COMPLETE_OPTIONS="host1 host2"
function _ssh_complete {
  local cur="${COMP_WORDS[COMP_CWORD]}"
  COMPREPLY=( $(compgen -W "${COMPLETE_OPTIONS}" -- ${cur}) )
}
complete -F _ssh_complete ssh

sábado, 17 de enero de 2015

ipfilter testing

add another port to sshd:
$ grep Port /etc/ssh/sshd_config
Port 22
Port 44444


test it works:
$ telnet 127.0.0.1 44444

block that port:
$ cat /etc/ipf/ipf.conf
set intercept_loopback true;
pass in all
pass out all
block in from any to any port = 44444
#pass in from 127.0.0.1 to any port = 44444


test it's blocked
$ telnet 127.0.0.1 44444

just in case we screw:
$ sudo crontab -l | tail -n1
* * * * * /usr/sbin/svcadm disable network/ipfilter

martes, 11 de noviembre de 2014

newline in sed or echo on Mac

$ echo hello | sed 's/hello/hello\'$'\nbye/'
hello
bye




$ echo hello | sed 's/hello/hello\'$'\n''bye1\'$'\nbye2/'
hello
bye1
bye2


$ sed -i '' 's/hello/hello\'$'\nbye/g' somefile.txt

martes, 10 de junio de 2014

Fast copy of directories using nc

receiving end (using port 10000):
nc -l 10000 | tar x

sending end:
cd parent_dir
tar cf - *hello* | nc receiving_hostname 10000