Skip to content

Instantly share code, notes, and snippets.

View josix's full-sized avatar
🐍

Josix josix

🐍
View GitHub Profile
@josix
josix / vimrc
Last active March 14, 2017 03:31
"========================================Setting Plugin======================================================
" Setting the plugin management pathogen to automatically execute plugins installed
" Setting to automaticlly dective and use plugins, then set indentation with different file types
execute pathogen#infect()
"Filetype plugin indent on
set nocompatible " not compatible with the old-fashion vi mode
filetype off " required!
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
" let Vundle manage Vundle
@josix
josix / tmux_cheatsheet.markdown
Last active November 29, 2017 12:03 — forked from henrik/tmux_cheatsheet.markdown
tmux cheatsheet

tmux cheatsheet

As configured in my dotfiles.

start new:

tmux

start new with session name:

@josix
josix / pep8_cheatsheet.py
Created April 18, 2018 17:43 — forked from RichardBronosky/pep8_cheatsheet.py
PEP-8 cheatsheet
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""This module's docstring summary line.
This is a multi-line docstring. Paragraphs are separated with blank lines.
Lines conform to 79-column limit.
Module and packages names should be short, lower_case_with_underscores.
Notice that this in not PEP8-cheatsheet.py
@josix
josix / nub.hs
Last active April 25, 2018 07:24
Implement nub function in Haskell
nub1 :: [Int] -> [Int]
nub1 xs = foldr isntElement [] xs
where isntElement x xs | length [y | y <- xs, y == x] == 0 = x:xs
| otherwise = xs
nub2 :: [Int] -> [Int]
nub2 [] = []
nub2 (x:xs) | length [y | y <- nub2 xs , y == x] /= 0 = nub2 xs
| otherwise = x : nub2 xs

Prerequisites: Basic Functional Programming in Haskell

Liang-Ting Chen

The first part of the following questions requires basic understanding of how to define a function in Haskell. The second part is a recursive function using techniques you should have learned from the first 4 chapters of Learn You a Haskell for Great Good!. Please check your answer using the interactive interpreter ghci before submission. If you are not familiar with the command-line interface, please read the first chapter of Real World Haskell.

Shell Command Note

awk

Scenario

When you don't want to print certain column.

awk '{$1="", $2=""}; print $0' FILE

For pattern maching a column.

if ($1 ~ /regex/) {...}
@josix
josix / Vim_cheatsheet.md
Last active September 28, 2018 09:41
Vim instruction cheatsheet
:reg "to show registers
Vri "for resplacing all characters in the line with 'i'
:g/^$/d "delete empty lines
"1p "paste register 1's value.
daw "cut a word including the trailling whitespace.
diw "cut a word exculding the surrounded whitespaces.
@josix
josix / gist:81f6c21381faa9710233aab9f317c605
Created February 12, 2019 16:21 — forked from entaroadun/gist:1653794
Recommendation and Ratings Public Data Sets For Machine Learning

Movies Recommendation:

Music Recommendation:

@josix
josix / Makefile
Created March 25, 2019 10:59 — forked from isaacs/Makefile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@josix
josix / test_embedding.py
Created October 26, 2020 14:35
test_embedding.py
import sys
import argparse
import random
import json
from collections import defaultdict
from itertools import zip_longest
from math import sqrt, isnan
import multiprocessing as mp
parser = argparse.ArgumentParser(description='Argument Parser')