Skip to content

Instantly share code, notes, and snippets.

@bjhaid
bjhaid / Install LT4 21.1.md
Created Sep 15, 2020 — forked from jetsonhacks/Install LT4 21.1.md
Install LT4 21.1 on Jetson TK1
View Install LT4 21.1.md

For best results, you should read through the official NVIDIA documentation found on:

https://developer.nvidia.com/linux-tegra-rel-21

In particular, the Quick Start Guide.

For this process you will need:

  • A host desktop or laptop computer running Ubuntu Linux 12.04 is officially recommended. In practice, this may be a virtual machine, I have used VirtualBox in the past. Also, I've successfully flashed from Ubuntu Linux 14.04. Your mileage may vary.
  • Micro USB cable provided with the Jetson TK1 kit
  • Jetson TK1 and power supply
View hugepages.md

Linux Hugepages

Hugepages are a hardware feature designed to reduce pressure on the translation lookaside buffer (TLB) for applications that operate on large contiguous memory regions.

Take a program that operates on a large 2MB internal structure as an example. If the program accesses that space in such a way that one byte in each regular 4k page is accessed, 2M/4k = 512 TLB entries are needed. Each TLB miss at the hardware level requires and interrupt and kernel intervention to resolve. However, if the allocation is backed by a 2M hugepage by mmap()ing with MAP_HUGETLB, only 1 TLB entry is required.

On x86_64, there are two hugepage sizes: 2MB and 1G. 1G hugepages are also called gigantic pages. 1G must be enabled on kernel boot line with hugepagesz=1G. Hugeages, especially 1G ones, should to be allocated early before memory fragments (i.e. at/near boot time) to increase the likelihood that they can be allocated successfully with minimal memory migration (i.e. defreg) required

@bjhaid
bjhaid / exit_notify.go
Created May 8, 2019 — forked from pmalmgren/exit_notify.go
Go proc connector example, detects when a process exits
View exit_notify.go
package main
import (
"bytes"
"encoding/binary"
"fmt"
"golang.org/x/sys/unix"
"os"
"syscall"
)
@bjhaid
bjhaid / ec2-metadata
Created Jan 22, 2019 — forked from copernicus/ec2-metadata
ec2-metadata: a simple tool for exploring Amazon EC2 metadata, extended with network and VPC info
View ec2-metadata
#!/bin/bash
#
#########################################################################
#This software code is made available "AS IS" without warranties of any #
#kind. You may copy, display, modify and redistribute the software #
#code either by itself or as incorporated into your code; provided that #
#you do not remove any proprietary notices. Your use of this software #
#code is at your own risk and you waive any claim against Amazon #
#Digital Services, Inc. or its affiliates with respect to your use of #
#this software code. (c) 2006-2007 Amazon Digital Services, Inc. or its #
View tcp.log
Dec 26 01:09:22 nodename kernel: [1220127.768482] TRACE: raw:PREROUTING:policy:8 IN=cali23b602f82b4 OUT= MAC=fa:1a:23:4c:0a:c0:6e:64:e6:2b:cb:40:08:00 SRC=192.168.7.163 DST=192.168.255.1 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=40679 DF PROTO=TCP SPT=47762 DPT=443 SEQ=3688814824 ACK=0 WINDOW=29200 RES=0x00 SYN URGP=0 OPT (020405B40402080A122D460F0000000001030307) MARK=0x4000000
Dec 26 01:09:22 nodename kernel: [1220127.788360] TRACE: mangle:PREROUTING:rule:1 IN=cali23b602f82b4 OUT= MAC=fa:1a:23:4c:0a:c0:6e:64:e6:2b:cb:40:08:00 SRC=192.168.7.163 DST=192.168.255.1 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=40679 DF PROTO=TCP SPT=47762 DPT=443 SEQ=3688814824 ACK=0 WINDOW=29200 RES=0x00 SYN URGP=0 OPT (020405B40402080A122D460F0000000001030307) MARK=0x4000000
Dec 26 01:09:22 nodename kernel: [1220127.827215] TRACE: nat:PREROUTING:rule:1 IN=cali23b602f82b4 OUT= MAC=fa:1a:23:4c:0a:c0:6e:64:e6:2b:cb:40:08:00 SRC=192.168.7.163 DST=192.168.255.1 LEN=60 TOS=0x00 PREC=0x00 TTL=64 ID=40679 DF PROTO=TCP SPT=47762 DPT=443 SEQ=3688814
View icmp.log
Dec 26 00:27:51 nodename kernel: [1217636.275432] TRACE: raw:PREROUTING:rule:4 IN=cali23b602f82b4 OUT= MAC=fa:1a:23:4c:0a:c0:6e:64:e6:2b:cb:40:08:00 SRC=192.168.7.163 DST=192.168.255.1 LEN=84 TOS=0x00 PREC=0x00 TTL=64 ID=28818 DF PROTO=ICMP TYPE=8 CODE=0 ID=83 SEQ=0 MARK=0x4000000
Dec 26 00:27:51 nodename kernel: [1217636.308852] TRACE: raw:PREROUTING:rule:5 IN=cali23b602f82b4 OUT= MAC=fa:1a:23:4c:0a:c0:6e:64:e6:2b:cb:40:08:00 SRC=192.168.7.163 DST=192.168.255.1 LEN=84 TOS=0x00 PREC=0x00 TTL=64 ID=28818 DF PROTO=ICMP TYPE=8 CODE=0 ID=83 SEQ=0 MARK=0x4000000
Dec 26 00:27:51 nodename kernel: [1217636.335845] TRACE: raw:PREROUTING:rule:6 IN=cali23b602f82b4 OUT= MAC=fa:1a:23:4c:0a:c0:6e:64:e6:2b:cb:40:08:00 SRC=192.168.7.163 DST=192.168.255.1 LEN=84 TOS=0x00 PREC=0x00 TTL=64 ID=28818 DF PROTO=ICMP TYPE=8 CODE=0 ID=83 SEQ=0 MARK=0x4000000
Dec 26 00:27:51 nodename kernel: [1217636.362602] TRACE: raw:PREROUTING:policy:8 IN=cali23b602f82b4 OUT= MAC=fa:1a:23:4c:0a:c0:6e:64:e6:2b:cb:40:08:00 SRC=192.168.7.163 DST=19
@bjhaid
bjhaid / main.go
Created Apr 28, 2017 — forked from julz/main.go
containersched minicontainer
View main.go
package main
import (
"fmt"
"os"
"os/exec"
"syscall"
)
func main() {
View DirReduc.java
import java.util.Stack;
class DirReduc {
static String inverse(String direction) {
String inv = "";
switch (direction) {
case "NORTH": inv = "SOUTH";
break;
case "SOUTH": inv = "NORTH";
break;
View dirReduc.rb
HASH = {
"NORTH" => "SOUTH",
"EAST" => "WEST",
"SOUTH" => "NORTH",
"WEST" => "EAST",
}
def dirReduc(arr)
res = []