Skip to content

Instantly share code, notes, and snippets.

TensorFlow

TFRecords

To create a TF Record:

  1. Open a TFRecords file using tf.python_io.TFRecordWriter
  2. Convert your data into the proper data type of the feature using tf.train.Int64List, tf.train.BytesList, or tf.train.FloatList
  3. Create a feature using tf.train.Feature and pass the converted data to it
  4. Create an Example protocol buffer using tf.train.Example and pass the feature to it
@wael34218
wael34218 / SysAdminCommands.md
Last active December 16, 2021 16:22
System Admin commands I usually use

Mounting new disks permanently

1- Check the disk you want to mount:

sudo blkid

Then you can mount it using

mount /dev/sda2 /path/to/mountpoint

Bash in Data Preparation

Balancing dataset based on labels

Clean arabic dataset

Limit number of words per sentence

Shuf clean and uniq

Git Commands

Initializing/Cloning a new project and status commands

Command Description
git init . Starting a new local git repository
git clone <RURL>:<Repo> [--branch <BN> --single-branch] Coping the repository from remote server [for cloning only one branch]
git status Show the working tree status
git log Show commit logs
@wael34218
wael34218 / Screen.md
Last active December 16, 2021 16:23

Screen Command

Command Description
screen –S NAME Create new screen
screen -ls List all screens started on the machine
screen –r NAME Reattach a session (if it is detached)
screen –x NAME Reattach to a session even if it is attached by other terminal.
[ctrl + a] [d] Detach from the current screen. Executed from inside the screen
[ctrl + d] Terminate screen. Executed from inside the screen
@wael34218
wael34218 / Vim.md
Last active December 16, 2021 16:23

Vim Basics

Basic Command Description
h, j, k, l ARROWS Move cursor left, down, up, right (You can also use arrows)
H, M, L Go to the first, middle and last line of current screen
ctrl+ [f, b] Jump forward, backward one full screen
ctrl+ [d, u] Jump down, up one half screen
w, b Move word forward, backward
0, $ Jump to start, end of line

Docker

docker <management_command> <sub_command>

Docker hub (https://hub.docker.com/) has a lot of community and official the docker images

Containers

Start a docker container