Skip to content

Instantly share code, notes, and snippets.

@yazinsai
yazinsai / tmux-cheatsheet.markdown
Created December 20, 2016 09:40 — forked from MohamedAlaa/tmux-cheatsheet.markdown
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname

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:

@yazinsai
yazinsai / slack_webhook_post.py
Last active May 8, 2019 09:49 — forked from devStepsize/slack_webhook_post.py
POST a JSON payload to a Slack Incoming Webhook using Python requests
'''
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
@yazinsai
yazinsai / dl
Last active May 19, 2019 12:25
Persistently run a process over SSH even if disconnected
#!/bin/sh
if test -t 1; then exec 1>/dev/null
fi
if test -t 2; then exec 2>/dev/null
fi
"$@" &
@yazinsai
yazinsai / Android-Emulator-on-AWS-EC2.md
Last active August 9, 2024 15:26 — forked from atyachin/Android-Emulator-on-AWS-EC2.txt
Installing and running Android Emulator on Amazon AWS EC2 (Ubuntu 16.04 / m5.xlarge)

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 / postgres-json-cheatsheet.md
Created January 10, 2020 05:07 — forked from rmtsrc/postgres-json-cheatsheet.md
Using JSON in Postgres by example

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
=begin
Converts:
# people.csv
Name, Age, Height
Ahmed, 12, 103
Mohamed, 19, 176
.. into:
# people.json
@yazinsai
yazinsai / util.js
Created May 1, 2020 11:50 — forked from tprynn/util.js
Frida utility functions
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) {
@yazinsai
yazinsai / parse-ayat.rb
Created July 5, 2020 09:45
A simple Ruby script to parse text from the Quran into text without diacritics
#!/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")
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));