Skip to content

Instantly share code, notes, and snippets.

View hasantahir's full-sized avatar

Hasan Tahir Abbas hasantahir

  • University of Glasgow
  • Glasgow, UK
  • 05:15 (UTC -12:00)
View GitHub Profile
@hasantahir
hasantahir / Git_Init
Last active August 3, 2016 04:50
Git procedure to upload to a Github Repo
First of all, initialize a git repo on the local machine by typing:
>>git init
in the git command prompt under the working directory.
In order to add the files one can use the command
>> git add .
The . ensures all files in the directory become part of the repo
At this time one can leave a commit message keeping track of the changes made in the repo
>> git commit -m "A message"
@hasantahir
hasantahir / latex_tricks.tex
Created August 2, 2016 17:58
Add this before each LaTeX document
% ------------------------------- Useful Tricks Learnt
% Use ={}& to align subequations to the left
% Use = for single equations
% Put comments % in between the lines in order to avoid forming a new paragraph.
% To enter special characters into Inkspace figures, use Ctrl+U and then enter the unicode. e.g., for \times symbol, the unicode is U+0D7. So the key entry would be Ctrl+U U+0d7 and then press enter.
%
% ----------------- To compile with references use the following order in Shell"
% 1. pdflatex filename.tex
% 2. bibtex filename (no extension)
% 3. bibtex filename (no extension)
@hasantahir
hasantahir / Clone_and_push
Last active May 24, 2017 11:59
Working with Git
I have messed many times syncnig local repos with remote ones. To avoid that in future, following is a short procedure that I need to follow.
1. If work has been started locally, start with the Gist with instructions on how to upload the local repo to Github.
2. If work has been started remotely,
First step is to clone the remote repo locally:
Once the local repo is initialized an synced with remote:
git init
git remote add <origin>
git clone
The above command creates a local clone of the remote repo that can be worked on the PC offline.
@hasantahir
hasantahir / tikz2png.sh
Created March 28, 2017 17:13 — forked from gangeli/tikz2png.sh
A script to convert Tikz images to PNG format
#!/bin/bash
#
# A quick and dirty bash script to convert a tikz image to a png.
# The necessary tweaks to the script to get it to work for your
# use case are as follows:
#
# 1. Change FIGURE_DEFINITIONS to point to your own figures.
# This file should contain a series of \newcommand definitions,
# one per figure.
#
@hasantahir
hasantahir / gist:a9065a12e873b6d80a33656ec3dd1425
Created June 22, 2017 00:18
Will Robertson's: LaTeX-templates: [ LaTeX Preamble - Font Choices ]
%% LaTeX Preamble - Font choices
%% Each block selects new math, roman (serif), sans serif, and typewriter fonts.
%% Delete or comment out all but one to make your choice.
% Fourier for math | Utopia (scaled) for rm | Helvetica for ss | Latin Modern for tt
\usepackage{fourier} % math & rm
\usepackage[scaled=0.875]{helvet} % ss
\renewcommand{\ttdefault}{lmtt} %tt
% Latin Modern (similar to CM with more characters)
@hasantahir
hasantahir / latex-clean.sh
Created June 22, 2017 15:44 — forked from djsutherland/latex-clean.sh
A bash script to clean latex temp files
#!/bin/bash
exts=".aux .lof .log .lot .fls .out .toc .dvi .bbl .bcf .blg -blx.aux -blx.bib -blx.bib .run.xml .fdb_latexmk .synctex.gz .syntex.gz(busy) .pdfsync .algorithms .alg .loa .thm .nav .snm .vrb .acn .acr .glg .glo .gls .brf .lol .idx .ilg .ind .ist .maf .mtc .mtc0 .pyg .nlo .tdo .xdy .keys"
for x in "${@:-.}"; do
arg=$(echo ${x:-.} | perl -pe 's/\.(tex|pdf)$//')
if [[ -d "$arg" ]]; then
for ext in $exts; do
rm -f "$arg"/*$ext
@hasantahir
hasantahir / gist:4d8c0ce2b415803c2ce96c9c8b94fc98
Created June 24, 2018 07:42
How to balance the last page columns in an IEEE document
Use flushend package in the preamble:
\usepackage[keeplastbox]{flushend}
Just at the end of the document before invoking bibliographies, call:
\atColsEnd{\vfil}
@hasantahir
hasantahir / gist:748da201881c66b0edd13d0890ef2196
Created November 11, 2018 11:42
Inkspace command to export pdf with proper font structure
inkscape --file=e_diag.svg --export-area-drawing --without-gui --export-latex --export-pdf=e_diag.pdf
Tip to avoid multipage pdf generation headache:
Ensure text is always top of eerything
select text and then Object -> Raise to top
All text objects can be selected from the find command enabling the 'select by type -> text' option.
Open the pdf_tex file after compiling, and delete the lines that says \includegraphics for pages other than 1
@hasantahir
hasantahir / init.lua
Last active June 8, 2020 16:20
My Config File of Hammerspoon
-- -----------------------------------------------------------------------
-- ** HammerSpoon Config File by S1ngS1ng with ❤️ ** --
-- -----------------------------------------------------------------------
-- *** Please refer to README.MD for instructions. Cheers! *** --
-- -----------------------------------------------------------------------
-- ** Something Global ** --
-- -----------------------------------------------------------------------
-- Uncomment this following line if you don't wish to see animations
@hasantahir
hasantahir / gist:716bdb311a4b18e63da94e2cc62e2e4e
Last active June 17, 2020 09:15
ImageMagick / Inkspace commands for compressing and converting between different file formats
%% To convert an animated PDF generated out of LaTeX into a GIF:
convert -verbose -delay 50 -loop 0 -density 300 file.pdf file.gif
%% Inkspace SVG to PDF:
```Tip to avoid multipage pdf generation headache:
Ensure text is always top of eerything
select text and then Object -> Raise to top
All text objects can be selected from the find command enabling the 'select by type -> text' option.