Showing posts with label mac. Show all posts
Showing posts with label mac. Show all posts

Wednesday, 6 February 2019

Monday, 4 February 2019

venv

brew install python3

mkdir -p ~/bin/python3
python3 -m venv ~/bin/python3
source ~/bin/python3/bin/activate

enjoy!

Friday, 19 September 2014

Mount read-only a Linux ext3/ext4 partition from within Mac OS

http://diesistmein.name/?p=30

or some variation.

Might help: http://osxdaily.com/2014/03/20/mount-ext-linux-file-system-mac/

Friday, 17 January 2014

MacBook and Openbox: mimic keyboard shortcut Cmd-tab application switcher

    <keybind key="W-Tab">
      <action name="NextWindow">
        <allDesktops>yes</allDesktops>
        <finalactions>
          <action name="Focus"/>
          <action name="Raise"/>
          <action name="Unshade"/>
        </finalactions>
      </action>
    </keybind>
    <keybind key="W-S-Tab">
      <action name="PreviousWindow">
        <finalactions>
          <action name="Focus"/>
          <action name="Raise"/>
          <action name="Unshade"/>
        </finalactions>
      </action>
    </keybind>

Macbook Air and Openbox: copy the Spotlight(TM) keyboard shortcut

    <keybind key="W-space">
      <action name="Execute">
        <command>dmenu_run</command>
      </action>
    </keybind>


apt-get install suckless-tools

Tuesday, 5 November 2013

Recover wireless of Ubuntu on MacBook Air 4,2

  1. sudo apt-get --reinstall install bcmwl-kernel-source
  2. sudo modprobe -r b43 ssb wl brcmfmac brcmsmac bcma
  3. sudo modprobe wl
Broadcom 802.11 Linux STA wireless driver source

Saturday, 2 November 2013

Read ext4 on Mac


  1. install xcode
  2. install brew
  3. brew install ext4fuse
    1. follow any instructions on changing permissions
  4. ext4fuse <device> <mountpoint>

Wednesday, 17 July 2013

Mac "Screen Sharing" using vncviewer and ssh tunnel

problem: Remmina (or similar) fail to connect to Mac over Cisco wireless (or whatever router is the problem), and you are tired of having to physically connect your Mac to make VNC work.

  1. make sure "Screen Sharing" is on as normal on your Mac
  2. ssh -L5900:localhost:5900 192.168.X.X
    1. replace 192.168.X.X with the IP of your Mac
    2. "Remote Login" is on
    3. set display to "Scaled" and "1024x768" if your Mac is just an Outlook client now
  3. vncviewer -encodings 'copyrect tight zrle hextile' localhost:5900

Wednesday, 27 February 2013

Right-click with Mac trackpad

Try selecting something and clicking anywhere on the trackpad with TWO fingers.

Friday, 22 February 2013

Increase bash history size on Mac


  1. Add below lines to end of ~/.bash_profile
  2. Source result or log out and back in
    1. source ~/.bash_profile
  3. Test
    1. echo $HISTFILESIZE
    2. echo $HISTSIZE
export HISTFILESIZE=2500

export HISTSIZE=""

Wednesday, 6 February 2013

Sunday, 3 February 2013

Fix jEdit fonts for MacBook Pro with Retina display


From: https://bugs.eclipse.org/bugs/show_bug.cgi?id=382972#c4
Assumptions: jEdit was installed into /Applications directory.


  1. Close any running jEdit
  2. Edit /Applications/jEdit.app/Contents/Info.plist
    1. At end of file, add the top two lines below above the bottom two lines, and save
  3. Drag jEdit to desktop
  4. Start jEdit and see if fonts fixed
  5. If fixed, drag jEdit back to /Applications, and retest.

<key>NSHighResolutionCapable</key>
<true/>
</dict>
</plist>

Saturday, 15 December 2012

OpenVPN on EC2/AWS


EC2 Instance
  1. Allow UDP to port 1194 under the instance's security group
    1. to the world 
    2. or just your IP network
Install and configure OpenVPN instance/server
  1. apt-get install openvpn
  2. cd /etc/openvpn
  3. openvpn --genkey --secret my.key
  4. Put code below into /etc/openvpn/server.conf
  5. Run: openvpn --config /etc/openvpn/server.conf
    1. Leave running while taking remaining steps
  6. Allow NAT
    1. modprobe iptable_nat
    2. echo 1 | sudo tee /proc/sys/net/ipv4/ip_forward
    3. iptables -t nat -A POSTROUTING -s 192.168.2.0/24 -o eth0 -j MASQUERADE
  7. Checks for the paranoid
    1. lsof -nP -i
    2. lsof -c openvpn

port 1194
proto udp
dev tun
secret /etc/openvpn/my.key
ifconfig 192.168.2.1 192.168.2.2
keepalive 10 120
comp-lzo
persist-key
persist-tun
status server-tcp.log
verb 3

  1. If on Mac, use tunnelblick to open a file like myopenvpn.ovpn with below code
    1. Replace hostname with yours
    2. You'll need the my.key file in the same directory as the myopenvpn.ovpn file
  2. On Linux
    1. Put below in /etc/openvpn/client.conf
    2. Put my.key in /etc/openvpn as well
    3. Run: openvpn --config /etc/openvpn/client.conf
    4. Leave running
  3. For all operating systems
    1. When/if you see this in the client connection logs/messages, you've made it
      1. "Initialization Sequence Completed"
  4. Confirm
    1. You can ping 192.168.2.1, the openvpn server/instance via the ssh tunnel
    2. You can ssh into the openvpn server/instance via 192.168.2.1
    3. You have a new network interface with 192.168.2.2 defined on it
    4. Goto: http://ipaddr.me
      1. Does it look like your IP?
      2. If uncertain, use "whois" command to find out
dev tun
proto udp
remote ec2-xxx-xxx-xxx-xxx.compute-1.amazonaws.com 1194
resolv-retry infinite
nobind
secret my.key
ifconfig 192.168.2.2 192.168.2.1
comp-lzo
verb 3
dhcp-option DNS 172.16.0.23
redirect-gateway def1

Thursday, 4 October 2012

ARP mechanism

  1. Computers Matterhorn and Washington are in an office
    1. connected to each other on the office local area network by 
      1. Ethernet cables and 
      2. network switches, 
    2. with no intervening gateways or routers
  2. Matterhorn wants to send a packet to Washington
    1. Through other means, it determines that Washington's IP address is 192.168.0.55. 
    2. In order to send the message, it also needs to know Washington's MAC address.
      1. First, Matterhorn uses a cached ARP table to look up 192.168.0.55 for any existing records of Washington's MAC address (00:eb:24:b2:05:ac). 
        1. If the MAC address is found,
          1. it sends the IP packet on the link layer to address 00:eb:24:b2:05:ac via the local network cabling. 
        2. If the cache did not produce a result for 192.168.0.55, 
          1. Matterhorn has to send a broadcast ARP message (destination FF:FF:FF:FF:FF:FF) requesting an answer for 192.168.0.55. 
          2. Washington responds with its MAC address (00:eb:24:b2:05:ac). 
            1. Washington may insert an entry for Matterhorn into its own ARP table for future use.
          3. The response information is cached in Matterhorn's ARP table and 
  3. the message can now be sent.

Saturday, 8 September 2012

mac delivery mechanism


  1. your computer has a default gateway set 
    1. can figure out packet is not destined for the local network
    2. will use the MAC address of the default gateway 
  2. default gateway receives the layer-2 frame
    1. will see that the MAC address matches it's own
    2. will un-encapsulate the data link frame and 
    3. pass the data part up to the network layer
  3. at the network layer, layer 3
    1. will see that the destination IP address does not match it's own
      1. this is a packet that is supposed to be routed
    2. will look in it's routing table for the closest match
      1. which interface to send the packet out on
  4. will create a new data link frame addressed to the next hop
    1. data portion of this frame sent out the appropriate interface
  5. process will continue at each router along the way

Assume that none of the info in already cached in an ARP table on any of the machines or routers 
  1. your computer wants to send some data to a computer on network 3
    1. your computer will create an IP packet addressed to 200.0.3.2
    2. your computer will send out an ARP request for the default gateway's MAC address 
    3. on receiving the MAC address, your computer will send out the IP packet
      1. encapsulated within a data link frame that is addressed to the MAC address of router a's interface on network 1
  2. router a will receive this frame
    1. send the data portion up to the network layer 
    2. at the network layer, router a will see that the packet is not addressed to router a
    3. router a will look in it's routing table to find out where to send the packet
    4. routing table will show that network 3 is reachable via network 2
    5. routing table will also show the IP address for the next hop is 200.0.2.2
    6. router a will send out an ARP request onto network 2 asking for router b's MAC address
    7. on receiving MAC, router a will send the IP packet 
      1. encapsulated in a data link frame addressed to router b's MAC address
  3. router b receives this frame it will do the same thing that router a did
    1. will send the IP packet up to the network layer
    2. see that the packet is not addressed to router b 
    3. will then look up in it's routing table for the closest match and see that it is directly connected to network 3
      1. here isn't a next hop router to send it to. 
    4. will send out an ARP request to learn the MAC address for 200.0.3.2
    5. when MAC is received, router b will send out the IP packet
      1.  encapsulated within a data link frame that is addressed to the MAC address of the destination computer
  4. destination computer will see that the data link frame is addressed to it
    1. will pass the IP packet to the network layer. 
    2. at the network layer, the IP address will also match that of the computer
    3. the data from the IP packet will be passed up to the transport layer

Interview questions: 2020-12

Terraform provider vs provisioner Load balancing Network Load Balancer vs Application Load Balancer  Networking Layer 1 vs Layer 4 haproxy u...