Skip to content

Instantly share code, notes, and snippets.

Avatar

Yazin yazinsai

View GitHub Profile
View speedUpVideos.js
const elemsIn = (tag, parent) => Array.from(parent.getElementsByTagName(tag));
const speedUp = (v) => v.playbackRate = 2;
const videos = elemsIn('video', document);
const iframes = elemsIn('iframe', document);
videos.forEach(speedUp);
iframes.forEach((f) => elemsIn('video', f.contentWindow.document).forEach(speedUp));
@yazinsai
yazinsai / parse-ayat.rb
Created Jul 5, 2020
A simple Ruby script to parse text from the Quran into text without diacritics
View parse-ayat.rb
#!/usr/bin/env ruby
# 1. Copy the raw text from https://www.corequran.com/
# 2. Run "ruby parse.rb"
# 3. Paste the copied text
# 4. Press "Ctrl + D" to see the output
def parse(str)
str
.split("\n")
@yazinsai
yazinsai / util.js
Created May 1, 2020 — forked from tprynn/util.js
Frida utility functions
View util.js
module.exports = {
hexStringToIntArray: function(str) {
var res = []
for(var i = 0; i < str.length; i += 2) {
res.push(parseInt(str.substring(i, i+2), 16))
}
return res
},
byteArrayToHexString: function(array) {
View CSV-to-json.rb
=begin
Converts:
# people.csv
Name, Age, Height
Ahmed, 12, 103
Mohamed, 19, 176
.. into:
# people.json
View postgres-json-cheatsheet.md

PostgreSQL JSON Cheatsheet

Using JSON in Postgres by example.

Quick setup via Docker

  1. Download and install: Docker Toolbox
  2. Open Docker Quickstart Terminal
  3. Start a new postgres container:
    docker run --name my-postgres -e POSTGRES_PASSWORD=mysecretpassword -d postgres
@yazinsai
yazinsai / Android-Emulator-on-AWS-EC2.md
Last active Sep 6, 2020 — forked from atyachin/Android-Emulator-on-AWS-EC2.txt
Installing and running Android Emulator on Amazon AWS EC2 (Ubuntu 16.04 / m5.xlarge)
View Android-Emulator-on-AWS-EC2.md

Getting the Android Emulator running on EC2 📱

# @ your EC2 instance
sudo apt update
sudo apt install openjdk-8-jre unzip
wget https://dl.google.com/android/repository/sdk-tools-linux-4333796.zip
unzip sdk-tools-linux-4333796.zip -d android-sdk
sudo mv android-sdk /opt/
export ANDROID_SDK_ROOT=/opt/android-sdk
@yazinsai
yazinsai / dl
Last active May 19, 2019
Persistently run a process over SSH even if disconnected
View dl
#!/bin/sh
if test -t 1; then exec 1>/dev/null
fi
if test -t 2; then exec 2>/dev/null
fi
"$@" &
@yazinsai
yazinsai / slack_webhook_post.py
Last active May 8, 2019 — forked from devStepsize/slack_webhook_post.py
POST a JSON payload to a Slack Incoming Webhook using Python requests
View slack_webhook_post.py
'''
This is an example of how to send data to Slack webhooks in Python with the
requests module.
Detailed documentation of Slack Incoming Webhooks:
https://api.slack.com/incoming-webhooks
'''
import requests
# Set the webhook_url to the one provided by Slack when you create the webhook at
View keybase.md

Keybase proof

I hereby claim:

  • I am yazinsai on github.
  • I am yazin (https://keybase.io/yazin) on keybase.
  • I have a public key whose fingerprint is 0D54 C43C 6D83 3AEE 0E44 32DE C193 119E 305E D218

To claim this, I am signing this object:

View tmux-cheatsheet.markdown

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
You can’t perform that action at this time.