This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <libelf.h> | |
| #include <elfutils/libdwelf.h> | |
| #include <unistd.h> | |
| #include <fcntl.h> | |
| #include <stdio.h> | |
| #include "util.h" | |
| char *get_debug(char *filename) | |
| { | |
| char *b=mymalloc(256); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #mlag test traffic detection filters | |
| for x in `seq 1 12`; do csub "{del,filter,entry,\"acl-Test-$x\"}"; done #remove | |
| for x in `seq 1 12`; do acl allow Test-$x InPorts=$x SrcMac=0,3,1,0,0,0 SrcMacMask=255,255,255,0,0,0 ; done #add | |
| watch -d 'showLacp; psh show filter | grep Test' #watch | |
| bcm l2 cache show #find index of entry with "mac=01:80:c2:00:00:02" | |
| #for instance: index -> 5 : mac=01:80:c2:00:00:02 vlan=0/0x000 modid=0 port=134217728/cpu0 prio=7 BPDU CPU ReplacePriority lookup_class =0 | |
| psh bcm l2 cache del cacheindex=5 # <- cache index from "bcm l2 cache show" # delete the entry to break lacp | |
| psh csub "{add,l2_entry,bpdu,[1,128,194,0,0,2],7,none,[]}" # reinstall entry to restore lacp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| splitmap(F,L,N) when length(L)>N -> {L1,L2}=lists:split(N,L), [F(L1) | splitmap(F,L2,N)]; | |
| splitmap(F,L,_N) -> F(L). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| noctrl() { sed 's/[\x01-\x1F\x7F]//g' | sed 's/\[[0-9]*m//g'; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #usage: ps3convert infile outfile | |
| ps3convert() { HandBrakeCLI -Z "High Profile" --subtitle-burn --subtitle 1 -i $1.* -o $1.mp4; } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| int simple_cli(char *filename,int (*parser)(char *cmdline),int count) | |
| { | |
| FILE *ifile = NULL; | |
| char cmdline[MAXCMDLINE]; | |
| int status = 0; | |
| for (cmdline[0]=0;count-- && !status && (ifile = fopen(filename,"r")) != NULL;fclose(ifile),cmdline[0]=0) | |
| while (fgets(cmdline,sizeof(cmdline)-1,ifile) && (!(status=parser(cmdline)))); | |
| return status; |