Skip to content

Instantly share code, notes, and snippets.

View adityaiitb's full-sized avatar

Aditya Agrawal adityaiitb

View GitHub Profile
@adityaiitb
adityaiitb / php.md
Created July 25, 2020 23:24
PHP commands

Start a php server locally (in the directory you want)

php -S localhost:8888 &
@adityaiitb
adityaiitb / splash_screen.md
Last active July 25, 2020 23:33
Android Splash Screen
  1. Draw the splash screen in gimp. For example, create a 1280 pixel x 720 pixel image with a pixel density of 240 ppi x 240 ppi (pixels per inch).

  2. Use the tool /Android/Sdk/tools/draw9patch which is part of Android SDK to mark regions which can be stretched. The overall image is 1282 x 722 pixels. Watch this video to see how to use the tool.

  3. Copy this image to /res/screen/android folder.

@adityaiitb
adityaiitb / svn.md
Created July 25, 2020 23:44
SVN commands

How to create and launch a local svn repo

We should allow normal users (after authentication) on the host machine to use SVN. We should not give access to normal users to the SVN directory itself. Notes from here

In the following commands, # => as root, $ => as user.

Create a directory to hold the repository

@adityaiitb
adityaiitb / debian_package.md
Created July 25, 2020 23:50
Extract a Debian package

DEB files are ar archives, which contain three files:

  • debian-binary
  • control.tar.gz
  • data.tar.gz

Unpacking this file is a two step process.

ar vx mypackage.deb
tar -xzvf data.tar.gz

Using pdftk

touch out.pdf
pdftk foo.pdf cat 1E output out.pdf

Using pdf270

pdf270 --suffix 'turned' foo.pdf
mv foo-turned.pdf foo.pdf
@adityaiitb
adityaiitb / embed_fonts_pdf.md
Created July 26, 2020 00:06
Embed Post Script fonts and create a PDF
ps2epsi foo.ps
#ps2pdf14 -dEPSCrop -dAutoRotatePages=/None -dPDFSETTINGS=/prepress -dEmbedAllFonts=true foo.epsi foo.pdf
ps2pdf14 -dEPSCrop -dAutoRotatePages=/All -dPDFSETTINGS=/prepress -dEmbedAllFonts=true foo.epsi foo.pdf
@adityaiitb
adityaiitb / aten.md
Last active July 26, 2020 00:19
How to use PyTorch ATen

A simple example of how to use PyTorch ATen directly using C++.

@adityaiitb
adityaiitb / onmt.py
Last active July 26, 2020 00:48
OMNT toolkit example
#!/usr/bin/env python
# python train.py -train_steps 1 -data data/demo -gpu_ranks 0
import subprocess
from itertools import product
src_emb = [128, 1024]
dst_emb = [128, 1024]
hidden = [128, 1024]
@adityaiitb
adityaiitb / saved_model_cli.md
Last active October 27, 2021 20:32
TensorFlow Saved Model CLI

Saved Model CLI

Saved Model CLI (show)

saved_model_cli show --dir resnet/1
saved_model_cli show --dir resnet/1 --tag_set serve
@adityaiitb
adityaiitb / numpy_npz.md
Last active July 30, 2020 15:13
Create a numpy npz file

The .npz file format is used to save several numpy arrays into a single zipped file. Documentation.

import numpy as np

a = np.array([42])
b = np.array([2, 3, 5, 7, 9]) 

with open("foo.npz", "wb") as f: