Skip to content

Instantly share code, notes, and snippets.

View alinasrullayev's full-sized avatar
🎯
Focusing

Ali Nasrullayev alinasrullayev

🎯
Focusing
  • Azeribaijan/Baku
View GitHub Profile
@alinasrullayev
alinasrullayev / kmeans.py
Created March 7, 2021 14:32 — forked from dave-andersen/kmeans.py
k-means in Tensorflow
import tensorflow as tf
import numpy as np
import time
N=10000
K=4
MAX_ITERS = 1000
start = time.time()
@alinasrullayev
alinasrullayev / lang.js
Created March 8, 2021 12:47 — forked from mirontoli/lang.js
Get Language name based on iso 639-1 code
/**
* @author Anatoly Mironov (mirontoli)
* http://sharepointkunskap.wordpress.com
* http://www.bool.se
*
* http://stackoverflow.com/questions/3605495/generate-a-list-of-localized-language-names-with-links-to-google-translate/14800384#14800384
* http://stackoverflow.com/questions/10997128/language-name-from-iso-639-1-code-in-javascript/14800499#14800499
*
* using Phil Teare's answer on stackoverflow
* http://stackoverflow.com/questions/3217492/list-of-language-codes-in-yaml-or-json/4900304#4900304
@alinasrullayev
alinasrullayev / fit.py
Created July 7, 2021 20:48 — forked from MaxHalford/fit.py
Keras fit/predict scikit-learn pipeline
import os
from keras import backend as K
from keras import callbacks
from keras import layers
from keras import models
from keras.wrappers.scikit_learn import KerasClassifier
import pandas as pd
import tensorflow as tf
from sklearn import metrics
@alinasrullayev
alinasrullayev / curl.md
Created August 17, 2021 18:17 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@alinasrullayev
alinasrullayev / jwtRS256.sh
Created August 29, 2021 19:00 — forked from ygotthilf/jwtRS256.sh
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub
@alinasrullayev
alinasrullayev / flask_abort_example.py
Created September 10, 2021 16:36 — forked from hirobert/flask_abort_example.py
flask abort as json
from flask import abort, make_response, jsonify
abort(make_response(jsonify(message="Message goes here"), 400))
@alinasrullayev
alinasrullayev / model_relation_ex.py
Created May 1, 2022 12:39 — forked from kirang89/model_relation_ex.py
Example for many-to-many relationship with extra columns in SQLAlchemy
import sqlalchemy
from sqlalchemy.ext.declarative import declarative_base
from sqlalchemy import Column, Integer, String, ForeignKey
from sqlalchemy.orm import sessionmaker, relationship
engine = sqlalchemy.create_engine('sqlite:///:memory:')
Base = declarative_base()
Windows 8 Preinstall Keys
=========================
Windows 8
46V6N-VCBYR-KT9KT-6Y4YF-QGJYH
Windows 8 Professional
V7C3N-3W6CM-PDKR2-KW8DQ-RJMRD
@alinasrullayev
alinasrullayev / export-pyspark-schema-to-json.py
Created July 1, 2022 11:08 — forked from stefanthoss/export-pyspark-schema-to-json.py
Export/import a PySpark schema to/from a JSON file
import json
from pyspark.sql.types import *
# Define the schema
schema = StructType(
[StructField("name", StringType(), True), StructField("age", IntegerType(), True)]
)
# Write the schema
with open("schema.json", "w") as f:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.