Skip to content

Instantly share code, notes, and snippets.

View mhsattarian's full-sized avatar
🎯
Focusing

Mohammad H. Sattarian mhsattarian

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

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 November 15, 2018 15:01
Instructions I found helpful to solve problems or install various packages and softwares on my Manjaro linux.

Sights of Experience!

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

@mhsattarian
mhsattarian / command
Created January 10, 2019 08:33
Requires Imagemagick to be installed
magick mogrify -gravity south -extent x87+0-20 -background transparent a.png
@mhsattarian
mhsattarian / JNB_endpoint.ipynb
Last active November 3, 2019 22:29 — forked from psychemedia/SimpleAPI.ipynb
Using Jupyter Notebooks as Rest API Endpoint
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 December 10, 2019 09:01
Geohash polyline decode and encode. use google's utility for interactive encoding: https://developers.google.com/maps/documentation/utilities/polylineutility
'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
*/

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 April 30, 2020 19:21
Springer Publications has recently released a huge list of books that are now free to access, Lets grab download links fr

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 July 9, 2020 13:43
Using puppeteer-core and chrome-aws-lamba to screenshot a web element
// 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) {
// 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();
// 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());