Skip to content

Instantly share code, notes, and snippets.

@abancp
abancp / gist:592386ff475eee41e063d4e8e2a875a6
Created December 8, 2023 03:19
Calculating Start Rating - Algorithm like Amazone
View gist:592386ff475eee41e063d4e8e2a875a6
Amazone use machine learning models to calculate rating of products . we can use simple average algorithms like this
(5* Number of 5star + 4 * Num of 4star + 3 * Num of 3star + 2 * Num of 2star + 1 * Num of 1star) / ( total number of ratings )
eg :
total number of ratings : 3790
5 star rating : 2373
4 star rating : 651
3 star rating : 268
2 star rating : 77
@FikriRNurhidayat
FikriRNurhidayat / Slow-Steam-Download-Speed-Linux.md
Last active December 8, 2023 03:20
Steam Download Speed Issue on Linux
View Slow-Steam-Download-Speed-Linux.md

Steam Download Speed is so slow on Linux

Oh boi, here I give you the solution for that. This document is based on these links:

Why is it slow?

I don't know, perhaps the Steam application doesn't cache the dns locally or something hence your computer will always lookup for the domain everytime you download it on each chunks. CMIIW.

@financial-python
financial-python / ema_crossover.py
Last active December 8, 2023 03:16
How to code an EMA crossover in Python
View ema_crossover.py
#import the necessary packages
import yfinance as yf
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
#download the historical stock data
aapl_df = yf.download("AAPL", start="2018-03-24", end="2023-03-24")
@justinhartman
justinhartman / 01_introduction.md
Last active December 8, 2023 03:07
Setup Debian 10 LEMP Virtual Machine or Server
View 01_introduction.md

How To Install Nginx, MySQL, PHP, Redis and more on a Debian 10 Virtual Machine

This series of documents will configure and setup a Nginx, MySQL, and PHP (LEMP) server on a pretty feature-rich VM running Debian. I used a VM with 8GB RAM and 4 CPU Cores so YMML with some of the settings below.

This will also install other useful packages and configurations like, Redis, Memcached, Node, NPM, Composer, and a fully automated SSL service using certbot for Let's Encrypt.

@netpoetica
netpoetica / Setting up Nginx on Your Local System.md
Last active December 8, 2023 03:05
Setting up Nginx on Your Local System
View Setting up Nginx on Your Local System.md

#Setting up Nginx on Your Local System ###by Keith Rosenberg

##Step 1 - Homebrew The first thing to do, if you're on a Mac, is to install homebrew from http://mxcl.github.io/homebrew/

The command to type into terminal to install homebrew is:

ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
@objcode
objcode / ConcurrencyHelpers.kt
Last active December 8, 2023 03:03
Helpers to control concurrency for one shot requests using Kotlin coroutines.
View ConcurrencyHelpers.kt
/* Copyright 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@watofundefined
watofundefined / syncthing-git-backup.md
Last active December 8, 2023 03:02
Syncthing git backup recipe
View syncthing-git-backup.md

Syncthing has awesome docs - start there if you haven't read them already. This is just a recipe to show how I set it up to have a git-versioned backup on Raspberry Pi.

Once machines are talking to each other via Syncthing add the folder through GUI, share it with another device, switch to that device and accept the incoming folder.

Let's say that the folder is ~/org.

On the 'backup' device in Syncthing GUI, go to Folder settings > File Versioning, choose "External File Versioning" and in Command input fill in: git-backup-org %FOLDER_PATH% %FILE_PATH%.

On the 'backup' device create the backup folder and initialize a git repository:

@wjkoh
wjkoh / dartls.lua
Last active December 8, 2023 03:01
LazyVim: Set up Dart and Flutter LSP
View dartls.lua
-- Copy this file to your ~/.config/nvim/lua/plugins/
-- This file was written by @cddm. See https://www.reddit.com/r/neovim/comments/14c5e6o/how_to_set_up_dartflutter_with_neovim/jojf4z5/
return {
{
"neovim/nvim-lspconfig",
opts = {
servers = {
dartls = {},
},
},
@eyecatchup
eyecatchup / calc-sapisidhash.js
Created April 14, 2022 07:39
Calculate SAPISIDHASH
View calc-sapisidhash.js
async function getSApiSidHash(SAPISID, origin) {
function sha1(str) {
return window.crypto.subtle.digest("SHA-1", new TextEncoder("utf-8").encode(str)).then(buf => {
return Array.prototype.map.call(new Uint8Array(buf), x=>(('00'+x.toString(16)).slice(-2))).join('');
});
}
const TIMESTAMP_MS = Date.now();
const digest = await sha1(`${TIMESTAMP_MS} ${SAPISID} ${origin}`);