Skip to content

Instantly share code, notes, and snippets.

@r14152
r14152 / gist:05b80a643f24a75c834cbdfa912c4f2c
Created March 8, 2018 16:52 — forked from entaroadun/gist:1653794
Recommendation and Ratings Public Data Sets For Machine Learning

Movies Recommendation:

Music Recommendation:

@r14152
r14152 / uploader.go
Created May 2, 2018 08:30 — forked from TheGU/uploader.go
Golang to upload file to google drive with progress bar using Google API
package main
import (
"encoding/json"
"fmt"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"
@r14152
r14152 / tmux.md
Created June 15, 2018 12:25 — forked from andreyvit/tmux.md
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a

@r14152
r14152 / The Technical Interview Cheat Sheet.md
Created December 17, 2018 18:25 — forked from tsiege/The Technical Interview Cheat Sheet.md
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

Studying for a Tech Interview Sucks, so Here's a Cheat Sheet to Help

This list is meant to be a both a quick guide and reference for further research into these topics. It's basically a summary of that comp sci course you never took or forgot about, so there's no way it can cover everything in depth. It also will be available as a gist on Github for everyone to edit and add to.

Data Structure Basics

###Array ####Definition:

  • Stores data elements based on an sequential, most commonly 0 based, index.
  • Based on tuples from set theory.
8.2.3. HTTP log format
----------------------
The HTTP format is the most complete and the best suited for HTTP proxies. It
is enabled by when "option httplog" is specified in the frontend. It provides
the same level of information as the TCP format with additional features which
are specific to the HTTP protocol. Just like the TCP format, the log is usually
emitted at the end of the session, unless "option logasap" is specified, which
generally only makes sense for download sites. A session which matches the
"monitor" rules will never logged. It is also possible not to log sessions for
// Copyright 2020 Douyu
//
// 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
//
// http://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,
@r14152
r14152 / extraLongFactorial.go
Created August 9, 2021 19:56
Calculate and print the factorial of a given integer.
package main
import (
"bufio"
"fmt"
"io"
"os"
"strconv"
"strings"
)
import(
"strings"
"fmt"
)
func lengthOfLastWord(s string) int {
str := strings.Split(s," ")
for j:= len(str)-1;j>=0;j--{
if str[j] == ""{
continue
@r14152
r14152 / anagram.go
Created August 12, 2021 15:27
Two words are anagrams of one another if their letters can be rearranged to form the other word. Given a string, split it into two contiguous substrings of equal length. Determine the minimum number of characters to change to make the two substrings into anagrams of one another.
//anagram used to check
//hackerank solution: https://www.hackerrank.com/challenges/anagram/problem
func anagram(s string) int32 {
if len(s)%2 != 0 {
return -1
}
runeMap := make(map[rune]int,0)
runesWord := []rune(s)
//fmt.Printf("Runes: %v:%d:%d\n", runesWord,(len(runesWord)-1)/2,((len(runesWord)-1)/2)+1)
for i:=0;i<=(len(runesWord)-1)/2;i++{
@r14152
r14152 / plusone.go
Created August 12, 2021 18:20
leetcode plusone problem solution
func plusOne(digits []int) []int {
length := len(digits)-1
var remain int
firstSum := true
for j:= length;j>=0;j--{
var sum int
if firstSum {
sum = digits[j]+1
firstSum = false
}else{