Skip to content

Instantly share code, notes, and snippets.

View yilmazerhakan's full-sized avatar
🏠
Working from home

Hakan Yılmazer yilmazerhakan

🏠
Working from home
View GitHub Profile
#---------------------
# MAKE RECOMMENDATION
#---------------------
def make_recommendation(user_id=None, num_items=10):
"""Recommend items for a given user given a trained model
Args:
user_id (int): The id of the user we want to create recommendations for.
@gramian
gramian / build_oct.sh
Last active April 27, 2024 01:07
Build Octave and numerical dependencies from source in Ubuntu 20.04
#!/bin/bash
# project: build_oct
# version: 1.12 (2023-01-01)
# authors: C. Himpe (0000-0003-2194-6754), M. Koehler (0000-0003-2338-9904)
# license: BSD-2-Clause License (opensource.org/licenses/BSD-2-Clause)
# summary: Build Octave and numerical dependencies from source (in Ubuntu 20.04 with GCC >= 10.3).
# requires hardware: either X86-64 with AVX2 or ARM64 with NEON.
# requires software packages: octave libpcre2-dev libreadline-dev libgmp3-dev libmpfr-dev libfreetype6-dev libgl2ps-dev libfontconfig1-dev libglu1-mesa-dev
@evfro
evfro / hybridsvd.py
Last active June 9, 2020 20:20
HybridSVD example
from scipy.sparse import csr_matrix
import scipy as sp
import numpy as np
from scipy.sparse.linalg import spsolve_triangular
# rating matrix
a = np.array([[1, 0, 1, 1, 0],
[1, 1, 0, 1, 0],
[1, 0, 0, 1, 0]])
@GhazanfarMir
GhazanfarMir / Instructions.sh
Last active May 14, 2024 03:26
Install PHP7.2 NGINX and PHP7.2-FPM on Ubuntu 16.04
########## Install NGINX ##############
# Install software-properties-common package to give us add-apt-repository package
sudo apt-get install -y software-properties-common
# Install latest nginx version from community maintained ppa
sudo add-apt-repository ppa:nginx/stable
# Update packages after adding ppa
@andrewdelprete
andrewdelprete / webpack.mix.js
Last active August 28, 2024 21:30
Laravel Mix: Tailwind CSS + PurgeCSS Example
let mix = require("laravel-mix");
let tailwindcss = require("tailwindcss");
let glob = require("glob-all");
let PurgecssPlugin = require("purgecss-webpack-plugin");
/**
* Custom PurgeCSS Extractor
* https://github.com/FullHuman/purgecss
* https://github.com/FullHuman/purgecss-webpack-plugin
*/
@yajra
yajra / axios-401-response-interceptor.js
Last active September 16, 2024 13:59
Axios 401 response interceptor.
// Add a 401 response interceptor
window.axios.interceptors.response.use(function (response) {
return response;
}, function (error) {
if (401 === error.response.status) {
swal({
title: "Session Expired",
text: "Your session has expired. Would you like to be redirected to the login page?",
type: "warning",
showCancelButton: true,
@engelju
engelju / elasticsearch-on-homestead.txt
Last active December 11, 2018 07:54 — forked from lukaswhite/elasticsearch-on-homestead.txt
Installing Elasticsearch on Laravel Homestead
# https://bosnadev.com/2014/09/12/install-elasticsearch-on-laravel-homestead/
# https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-repositories.html
# https://www.elastic.co/blog/elasticsearch-unplugged
# Install Java
sudo apt-get install openjdk-7-jre-headless -y
# Download & install the Public Signing Key
wget -qO - https://packages.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
@itamarhaber
itamarhaber / learn.lua
Created January 10, 2016 15:30 — forked from tylerneylon/learn.lua
Learn Lua quickly with this short yet comprehensive and friendly script. It's written as both an introduction and a quick reference. It's also a valid Lua script so you can verify that the code does what it says, and learn more by modifying and running this script in your Lua interpreter.
-- Two dashes start a one-line comment.
--[[
Adding two ['s and ]'s makes it a
multi-line comment.
--]]
----------------------------------------------------
-- 1. Variables and flow control.
----------------------------------------------------
@nestoru
nestoru / Solution for mysql Warning: Using a password on the command line interface can be insecure
Last active October 23, 2021 21:20
Solution for mysql Warning: Using a password on the command line interface can be insecure
# Let us consider the following typical mysql backup script:
mysqldump --routines --no-data -h $mysqlHost -P $mysqlPort -u $mysqlUser -p$mysqlPassword $database
# It succeeds but stderr will get:
# Warning: Using a password on the command line interface can be insecure.
# You can fix this with the below hack:
credentialsFile=/mysql-credentials.cnf
echo "[client]" > $credentialsFile
echo "user=$mysqlUser" >> $credentialsFile
echo "password=$mysqlPassword" >> $credentialsFile
@paulirish
paulirish / what-forces-layout.md
Last active September 19, 2024 22:56
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent