Skip to content

Instantly share code, notes, and snippets.

View hvardhanx's full-sized avatar
🦄
Whattttttt up!?

Harsh Vardhan hvardhanx

🦄
Whattttttt up!?
View GitHub Profile
#!/bin/bash
DATASETS=$(bq ls --format=sparse | tail -n+3 | grep -v scratch)
for d in $DATASETS; do
TABLES=$(bq ls --format=prettyjson "$d" | jq '.[] | "\(.id), \(.type)"')
IFS=$'\n'
for table in $TABLES; do
[[ ! "$table" == *VIEW* ]] && continue
view=$(echo "$table" | sed -e 's/"//g' | cut -d , -f 1)
query=$(bq show --format=prettyjson "$view" | jq -r '.view.query')
C-f Move forward a character
C-b Move backward a character
M-f Move forward a word
M-b Move backward a word
C-n Move to next line
C-p Move to previous line
C-a Move to beginning of line
import os
import fcntl
import select
def udp_server(host='127.0.0.1', port=1234):
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s.setblocking(False)
logger.info(f"Listening on udp {host}:{port}")
s.bind((host, port))
@hvardhanx
hvardhanx / netspeed.sh
Created May 1, 2019 16:42
Net speed of packets per second
#!/bin/bash
INTERVAL="1" # update interval in seconds
if [ -z "$1" ]; then
echo
echo usage: $0 [network-interface]
echo
echo e.g. $0 eth0
echo
@hvardhanx
hvardhanx / netdrop.sh
Created May 1, 2019 16:41
Net packet drop per second
!/bin/bash
INTERVAL="1" # update interval in seconds
if [ -z "$1" ]; then
echo
echo usage: $0 [network-interface]
echo
echo e.g. $0 eth0
echo
@hvardhanx
hvardhanx / netpps.sh
Created May 1, 2019 16:40
Net Packet per second
#!/bin/bash
INTERVAL="1" # update interval in seconds
if [ -z "$1" ]; then
echo
echo usage: $0 [network-interface]
echo
echo e.g. $0 eth0
echo
. = any char
\. = the actual dot character
.? = .{0,1} = match any char zero or one times
.* = .{0,} = match any char zero or more times
.+ = .{1,} = match any char one or more times
@hvardhanx
hvardhanx / git.md
Created March 3, 2018 12:20
Fix merge conflicts

If you want to merge from branch(test) to master, you can follow these steps:

Step1: Go to the branch

git checkout test

Step2: git pull --rebase origin master

Step3: If there are some conflicts, go to these files to modify it.

@hvardhanx
hvardhanx / compton.conf
Created February 15, 2018 08:00
Compton config
# Shadow
shadow = true;
# no-dnd-shadow = true;
# no-dock-shadow = true;
clear-shadow = true;
detect-rounded-corners = true;
shadow-radius = 5;
shadow-offset-x = 1;
shadow-offset-y = 1;
shadow-opacity = .3;