This file contains 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
#!/bin/bash | |
# Number of units of each cryptocurrency. | |
u_bc=0.73674311 | |
u_eth=0.75795629 | |
u_rip=251.065810 | |
# Get prices of each from https://api.coingecko.com/api/v3/coins/list | |
bc=`curl "https://api.coingecko.com/api/v3/coins/markets?vs_currency=inr&ids=bitcoin" 2> /dev/null | jq . | grep current_price | awk '{print $NF}' | cut -d, -f1 &` | |
eth=`curl "https://api.coingecko.com/api/v3/coins/markets?vs_currency=inr&ids=ethereum" 2> /dev/null | jq . | grep current_price | awk '{print $NF}' | cut -d, -f1 &` |
This file contains 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
#!/bin/bash | |
bridge fdb del 52:54:00:00:12:53 dev ens36v0 | |
bridge fdb del 52:54:00:00:12:53 dev vmtap01 master | |
virsh attach-device --config --live vm01 vf.xml | |
virsh domif-setlink vm01 vmtap01 down |
This file contains 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
#!/bin/bash | |
DOMAIN=vm-01 | |
PF=ens6np0 | |
VF=ens6v1 # VF attached to the bridge. | |
VF_NUM=1 | |
TAP_IF=vmtap01 # virtio-net interface in the VM. | |
VF_XML=vf.xml | |
MAC=52:54:00:00:12:53 |
This file contains 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
# cat vf.xml | |
<interface type='hostdev' managed='yes'> | |
<mac address='52:54:00:00:12:53'/> | |
<source> | |
<address type='pci' domain='0x0000' bus='0x42' slot='0x02' function='0x5'/> | |
</source> | |
<teaming type='transient' persistent='ua-backup0'/> | |
</interface> |
This file contains 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
4: ens10: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc noqueue state UP group default qlen 1000 | |
link/ether 52:54:00:00:12:53 brd ff:ff:ff:ff:ff:ff | |
inet 192.168.12.53/24 brd 192.168.12.255 scope global dynamic ens10 | |
valid_lft 42482sec preferred_lft 42482sec | |
inet6 fe80::97d8:db2:8c10:b6d6/64 scope link | |
valid_lft forever preferred_lft forever | |
5: ens10nsby: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master ens10 state DOWN group default qlen 1000 | |
link/ether 52:54:00:00:12:53 brd ff:ff:ff:ff:ff:ff | |
7: ens11: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq master ens10 state UP group default qlen 1000 | |
link/ether 52:54:00:00:12:53 brd ff:ff:ff:ff:ff:ff |
This file contains 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
<interface type='network'> | |
<mac address='52:54:00:00:12:53'/> | |
<source network='enp66s0f0_br'/> | |
<target dev='tap01'/> | |
<model type='virtio'/> | |
<driver name='vhost' queues='4'/> | |
<link state='down'/> | |
<teaming type='persistent'/> | |
<alias name='ua-backup0'/> | |
</interface> |
This file contains 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
entry: | __x64_sys_sendto() { | |
entry: | __sys_sendto() { | |
entry: | sockfd_lookup_light() { | |
exit: 0.722 us | } | |
entry: | sock_sendmsg() { | |
entry: | security_socket_sendmsg() { | |
entry: | apparmor_socket_sendmsg() { | |
exit: 0.763 us | } | |
exit: 1.069 us | } | |
entry: | inet_sendmsg() { |
This file contains 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
1. Create a socket: | |
server_fd = socket(...); | |
2. Bind to a well known IP address and port#: | |
ret = bind(server_fd, ...); | |
3. Mark the socket as passive by changing it's state to LISTEN: | |
ret = listen(server_fd, ...); | |
4. Wait for a client to connect, and get a reference file descriptor: | |
client_fd = accept(server_fd, ...); |
This file contains 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
const struct linger opt = { .l_onoff = 1, .l_linger = 0 }; | |
setsockopt(fd, SOL_SOCKET, SO_LINGER, &opt, sizeof opt); | |
close(fd); |
This file contains 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
srv_addr.sin_family = AF_INET; | |
srv_addr.sin_addr.s_addr = INADDR_ANY; | |
srv_addr.sin_port = htons(SERVER_PORT); | |
bind(fd, &srv_addr, sizeof srv_addr); |
NewerOlder