Skip to content

Instantly share code, notes, and snippets.

View mizhka's full-sized avatar

Michael Zhilin mizhka

  • PostgresPro
  • Moscow
View GitHub Profile
<html>
<!DOCTYPE html>
<meta charset="utf-8">
<!-- Load d3.js -->
<script src="https://d3js.org/d3.v4.js"></script>
<!-- Create a div where the graph will take place -->
<div id="my_dataviz"></div>
<script>
function humanFileSize(bytes, si) {
alias sw=etherswitchcfg
sw port0 striptag
sw port1 striptag
sw port1 pvid 2
sw port3 addtag
sw port4 addtag
sw vlangroup0 members 0,2,3,4
Result:
@mizhka
mizhka / sysctl-tunables
Created June 4, 2019 09:40
FreeBSD 13-GENERIC-CURRENT tunables
kern.maxproc: Maximum number of processes
kern.ngroups: Maximum number of supplemental groups a user can belong to
kern.ipc.shm_allow_removed: Enable/Disable attachment to attached segments marked for removal
kern.ipc.shm_use_phys: Enable/Disable locking of shared memory pages in core
kern.ipc.shmall: Maximum number of pages available for shared memory
kern.ipc.shmseg: Number of segments per process
kern.ipc.shmmni: Number of shared memory identifiers
kern.ipc.shmmin: Minimum shared memory segment size
kern.ipc.shmmax: Maximum shared memory segment size
kern.ipc.semaem: Adjust on exit max value
BUFFALO U-BOOT Ver 1.03
AP93 (ar7240) U-boot
sri
=====================================================================================================================================
TAP CALC (read_cnt=512)
----+--------------------------------------------------------------------------------------------------------------------------------
TAP | 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
----+--------------------------------------------------------------------------------------------------------------------------------
FAIL| 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 512 512 512 512 512 512 512 512 512 512 51
GOOD:
ar7240> erase 0xbf040000 +0x160000
Erase Flash from 0xbf040000 to 0xbf19ffff in Bank # 1
First 0x40 last 0x19f sector size 0x1000
400
Erased 352 sectors
ar7240> cp.b 0x81000000 0xbf040000 0x160000
Copy to Flash...
Copy 1441792 byte to Flash... write addr: bf040000
@mizhka
mizhka / gist:0e1461c360b133d526ebe0854635cf44
Created May 20, 2019 07:32
WHR-300 FreeBSD firmware - entropy
% binwalk -E whr300-tftp-noheader.bin
WARNING: Failed to import pyqtgraph module, visual entropy graphing will be disabled
DECIMAL HEXADECIMAL ENTROPY
--------------------------------------------------------------------------------
0 0x0 Rising entropy edge (0.985684)
1392640 0x154000 Falling entropy edge (0.000000)
1443840 0x160800 Rising entropy edge (0.989380)
3745792 0x392800 Falling entropy edge (0.693819)
dig, host - fetches DNS information
fuser - displays the PIDs of processes using the specified files or file systems.
gcore - generate a core file of a running program
gdb - allow you to see what is going on ''inside'' another program / coredump
iotop - watches I/O usage information output and displays a table of current I/O usage by processes or threads on the system
lftp - a file transfer program that allows sophisticated ftp, http and other connections to other hosts (including parallel transfer)
lsof - lists on its standard output file information about files opened by processes
nc - networking utility for reading from and writing to network connections using TCP or UDP
nmon - a huge amount of important performance information in one go
pbzip2 - a parallel implementation of the bzip2 block-sorting file compressor that uses pthreads and achieves near-linear speedup on SMP machines
@mizhka
mizhka / gist:d26481c21ceaab93516ad73842ce70b6
Created May 14, 2019 12:18
Poor Man FreeBSD DDB stacktraces
CODE:
int debug = 1;
sysctlbyname("debug.kdb.enter", NULL, NULL, &debug, sizeof(debug));
WHERE:
libc - abort
login - bail
@mizhka
mizhka / old-mips-malloc-init-issue.lst
Created February 14, 2018 23:16
old-mips-malloc-init-issue.lst
CFE> boot -tftp 192.168.1.2:/kernel.BCM.tramp.bin -raw -max=0x700000 -addr=0x80900000
Loader:raw Filesys:tftp Dev:eth0 File:192.168.1.2:/kernel.BCM.tramp.bin Options:(null)
Loading: CFE works as TFTP Client.
.......TFTP_BLKLEN!!
break!! last block!!
.. 5419928 bytes read
Entry at 0x80900000
Closing network.
Starting program at 0x80900000
entry: mips_init()
U-Boot 1.1.3 (Jul 8 2013 - 10:13:26)
Board: Ralink APSoC DRAM: 32 MB
relocate_code Pointer at: 81fb4000
******************************
Software System Reset Occurred
******************************
spi_wait_nsec: 42
spi device id: c2 20 16 c2 20 (2016c220)
find flash: MX25L3205D