Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

Mohammad H. Sattarian mhsattarian

🎯
Focusing
View GitHub Profile
@mhsattarian
mhsattarian / linux_fun.md
Created Oct 6, 2018 — forked from zlorb/linux_fun.md
How to have some fun using the terminal.
View linux_fun.md

Linux fun-o-matic

How to have some fun using the terminal.

  1. Install cowsay [0] via : sudo apt-get install cowsay
  2. Install fortune [1] via : sudo apt-get install fortune
  3. Install figlet [3] via : sudo apt-get install figlet
  4. Make sure you have Ruby installed via : ruby -v
  5. Install the lolcat [2] via : gem gem install lolcat
  6. (option) Add to .bash_profile and/or .bashrc
@mhsattarian
mhsattarian / Sights of Experience.md
Last active Nov 15, 2018
Instructions I found helpful to solve problems or install various packages and softwares on my Manjaro linux.
View Sights of Experience.md

Sights of Experience!

Instructions I found helpful to solve problems or install various packages and softwares on my Manjaro linux.

@mhsattarian
mhsattarian / command
Created Jan 10, 2019
Requires Imagemagick to be installed
View command
magick mogrify -gravity south -extent x87+0-20 -background transparent a.png
@mhsattarian
mhsattarian / JNB_endpoint.ipynb
Last active Nov 3, 2019 — forked from psychemedia/SimpleAPI.ipynb
Using Jupyter Notebooks as Rest API Endpoint
View JNB_endpoint.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mhsattarian
mhsattarian / polyline.js
Last active Dec 10, 2019
Geohash polyline decode and encode. use google's utility for interactive encoding: https://developers.google.com/maps/documentation/utilities/polylineutility
View polyline.js
'use strict';
/**
* Based off of [the offical Google document](https://developers.google.com/maps/documentation/utilities/polylinealgorithm)
*
* Some parts from [this implementation](http://facstaff.unca.edu/mcmcclur/GoogleMaps/EncodePolyline/PolylineEncoder.js)
* by [Mark McClure](http://facstaff.unca.edu/mcmcclur/)
*
* @module polyline
*/
View connecting using serial console.md

Install minicom to access serial console:

sudo pacman -S minicom

run minicom :

sudo minicom -D /dev/ttyUSB0
@mhsattarian
mhsattarian / Download-Springer-Free-Ebooks.md
Last active Apr 30, 2020
Springer Publications has recently released a huge list of books that are now free to access, Lets grab download links fr
View Download-Springer-Free-Ebooks.md

Download Springer Free Ebooks

Springer Publications has recently released a huge list of books that are now free to access, Let's grab download links for them.

Ebook links

List of books is available as an google sheet. you can also use this repository to download them. but, it's a python script to download them and is probably slow and as far as I checked is not using download managers like aria2, so I decided to grab the download links automatically and download them using IDM.

@mhsattarian
mhsattarian / screenshot_example.js
Last active Jul 9, 2020
Using puppeteer-core and chrome-aws-lamba to screenshot a web element
View screenshot_example.js
// Code from https://github.com/leighhalliday/generate-og-image/blob/master/src/chromium.ts
// and https://github.com/wesbos/wesbos/blob/master/functions/ogimage/ogimage.js
// and thanks wes.bos for the video on this at https://youtu.be/A0Ww-SU7K5E
const chrome = require("chrome-aws-lambda");
const puppeteer = require("puppeteer-core");
const exePath = "/usr/bin/google-chrome";
async function getOptions(isDev) {
View screenshot_html_element.js
// Code from https://github.com/leighhalliday/generate-og-image/blob/master/src/chromium.ts
// and https://github.com/wesbos/wesbos/blob/master/functions/ogimage/ogimage.js
// and thanks wes.bos for the video on this at https://youtu.be/A0Ww-SU7K5E
async function getScreenshot(html, isDev) {
const options = await getOptions(isDev);
console.log("📸");
const browser = await puppeteer.launch(options);
const page = await browser.newPage();
View use_screenshot.js
// Code from https://github.com/leighhalliday/generate-og-image/blob/master/src/chromium.ts
// and https://github.com/wesbos/wesbos/blob/master/functions/ogimage/ogimage.js
// and thanks wes.bos for the video on this at https://youtu.be/A0Ww-SU7K5E
exports.handler = async (event, context, callback) => {
const url = event.queryStringParameters.url;
const r = await fetch(
`https://publish.twitter.com/oembed?url=${url}&hide_thread=true`
).then((r) => r.json());