Skip to content

Instantly share code, notes, and snippets.

View LordAmit's full-sized avatar

Amit Seal Ami LordAmit

View GitHub Profile
@LordAmit
LordAmit / pdf_optimize_script.sh
Last active February 19, 2022 21:50
Using GhostScript to optimize PDF file size while maintaining full texts
#!/bin/sh
# /screen can be changed to the following:
# /screen selects low-resolution output similar to the Acrobat Distiller (up to version X) "Screen Optimized" setting.
# /ebook selects medium-resolution output similar to the Acrobat Distiller (up to version X) "eBook" setting.
# /printer selects output similar to the Acrobat Distiller "Print Optimized" (up to version X) setting.
# /prepress selects output similar to Acrobat Distiller "Prepress Optimized" (up to version X) setting.
# /default selects output intended to be useful across a wide variety of uses, possibly at the expense of a larger output file.
# from https://www.ghostscript.com/doc/9.54.0/VectorDevices.htm
# Script copied and modified from https://stackoverflow.com/questions/10450120/optimize-pdf-files-with-ghostscript-or-other
gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -sOutputFile=output.pdf $1
@LordAmit
LordAmit / pdf_add_margin_annotation.sh
Last active February 20, 2022 22:14
Adding Right Margin to PDF for Writing Notes or Annotations
#!/bin/sh
## DISCLAIMERS
## 1. This script is not intended to be used as is. It is more like a set of instructions; by no means you are supposed to execute it exactly like this every.single.time.
## 2. Credit for mentioning pdf-crop-margins goes to https://unix.stackexchange.com/a/638371
# go to your desired directory
cd ~/git/pdfcropmargin
# create a venv
python3 -m venv venv
<!doctype html>
<html amp lang="en">
<head>
{% include meta.html %}
<link rel="canonical" href="{{ site.url}}{{site.baseurl}}{{ page.url | replace: '/amp', '' }}">
<title>{% if page.title %}{{ page.title }} – {% endif %}{{ site.name }}</title>
{% capture styles %}
{% include amp_style.scss %}
{% endcapture %}
<style amp-custom>
@LordAmit
LordAmit / _amit_highlight.scss
Last active July 22, 2020 21:20
a syntax highlighter theme based on lots of other themes. The difference? I made sure that I picked colors which has a good contrast in terms of accessibility. You can use it with Jekyll, rouge, pygments, whatever floats your boat. :)
// based on friendly and more.
// an accessible, eye-friendly syntax highlighter theme based on lots of other themes.
// The difference? I made sure that I picked colors with good contrast in terms of accessibility.
// You can use it with Jekyll, rouge, pygments, whatever floats your boat. :)
// I checked the colors using Chrome Developer tools for color contrast.
// Please let me know if I missed anything, or if you have any suggestions.
// code style
code {
@LordAmit
LordAmit / img.html
Created June 27, 2018 07:25
hugo amp lightbox image shortcode with unique ID assignment
<!-- you also need to add the following script
<script async custom-element="amp-image-lightbox" src="https://cdn.ampproject.org/v0/amp-image-lightbox-0.1.js"></script>
-->
{{$unique_id := now.UnixNano}}
<amp-image-lightbox id="{{ $unique_id }}"
layout="nodisplay"></amp-image-lightbox>
<figure {{ if .Get "class" }} class='{{ .Get "class" }}'
{{else}} class="image-center" {{ end }} >
<amp-img
on='tap:{{ $unique_id }}'
from typing import Union
from typing import Type
class A():
a: int = 0
b: int = 0
class B():
from typing import Union
class A():
a: int = 0
b: int = 0
class B():
a: int = 0
b: int = 0
@LordAmit
LordAmit / config
Created December 22, 2016 14:52
.ssh/config for alternative connection to github and gitlab, in case port 22 is blocked
Host gitlab.com
Hostname altssh.gitlab.com
User git
Port 443
PreferredAuthentications publickey
Host github.com
Hostname ssh.github.com
User git
Port 443
PreferredAuthentications publickey
@LordAmit
LordAmit / rename.sh
Created October 22, 2016 07:34
rename_extension.sh
//will rename .txt to .odt
rename.ul .txt .odt *.txt
@LordAmit
LordAmit / malware.html
Created October 1, 2016 20:52
Found it from a facebook spam post. Possibly malware.
<html>
<head>
<link type='text/css' rel='stylesheet' href='https://www.blogger.com/static/v1/widgets/3899416659-widget_css_bundle.css' />
<link type='text/css' rel='stylesheet' href='https://www.blogger.com/dyn-css/authorization.css?targetBlogID=6094798206047175843&zx=1c585dee-919b-4f1d-a7a8-5b3a64a0d4d6' />
<style id='page-skin-1' type='text/css'><!--
body{ background: #e9eaed; text-align: center; margin: 0; } body{ display: none; }
--></style>
<script type='text/javascript'>
//<![CDATA[
var prnsd = window;