Skip to content

Instantly share code, notes, and snippets.

@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
@yazinsai
yazinsai / Android-Emulator-on-AWS-EC2.md
Last active March 29, 2024 07:45 — 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 / 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 / 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

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 / 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
/*
Coded by Marjan Olesch
Sketch from Insctructables.com
Open source - do what you want with this code!
*/
#include <Servo.h>
int PIN_ESC = 9, value = 0;
Servo srvESC;
@yazinsai
yazinsai / ImportJSON.gs
Created April 26, 2016 13:38
Get data from any API straight into your Google Sheets, effortlessly!
/*====================================================================================================================================*
ImportJSON by Trevor Lohrbeer (@FastFedora)
====================================================================================================================================
Version: 1.2.1
Project Page: http://blog.fastfedora.com/projects/import-json
Copyright: (c) 2012-2013 by Trevor Lohrbeer
License: GNU General Public License, version 3 (GPL-3.0)
http://www.opensource.org/licenses/gpl-3.0.html
------------------------------------------------------------------------------------------------------------------------------------
A library for importing JSON feeds into Google spreadsheets. Functions include:
32.502345269453031 31.70700584656992
53.426804033275019 68.77759598163891
61.530358025636438 62.562382297945803
47.475639634786098 71.546632233567777
59.813207869512318 87.230925133687393
55.142188413943821 78.211518270799232
52.211796692214001 79.64197304980874
39.299566694317065 59.171489321869508
48.10504169176825 75.331242297063056
52.550014442733818 71.300879886850353
# y = theta_1 * x + theta_0
# Not actually required in the gradient descent calculation; just used to verify
# the sanity of the results :)
def compute_error_for_line_given_points(theta_0, theta_1, points):
totalError = 0
for i in range(0, len(points)):
x = points[i, 0]
y = points[i, 1]
totalError += (y - (theta_1 * x + theta_0)) ** 2
return totalError / (2 * float(len(points)))