Skip to content

Instantly share code, notes, and snippets.

@lancatlin
lancatlin / convolution.py
Created April 8, 2020 07:12
Simple Convolution
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import sys
def convolution(img, kernel):
print(img.shape)
result = np.zeros((len(img) - len(kernel) + 1, len(img[0]) - len(kernel[0]) + 1, 3), dtype=np.uint8)
print(result.shape)
for i in range(result.shape[0]):
@lancatlin
lancatlin / main.rs
Created March 31, 2020 13:20
Determinant
use std::io;
fn main() {
println!("Please input the matrix:");
let v = read_matrix();
print_matrix(&v);
let d = determinant(&v);
println!("determinant is {}", d);
}
@lancatlin
lancatlin / yijun.cpp
Last active October 26, 2019 14:27
yijun
#include <stdio.h>
void swap(int *a, int *b) {
int tmp = *a;
*a = *b;
*b = tmp;
}
int gcd(int a, int b) {
if (a < b) {

Keybase proof

I hereby claim:

  • I am lancatlin on github.
  • I am wancat (https://keybase.io/wancat) on keybase.
  • I have a public key ASB4ozU-l6rqNv3R3GU3Wu_TCfUgBs6bwgu3UJntEMOMWAo

To claim this, I am signing this object:

@lancatlin
lancatlin / main.go
Created July 24, 2019 01:58
getting-along-with-integer-partitions
package main
import(
"fmt"
"os"
"strconv"
"sort"
"time"
)
@lancatlin
lancatlin / sync-backup
Created March 22, 2019 12:46
Sync Backup Tool
#!/bin/bash
# A tool for backup files by setting variable, a wrapper of Rsync
# Author: Wancat
FILE_NAME=".syncpath"
METHOD=$1
FILE=$2
OPTION=$3
# Load $SYNC_PATH
if [ -f $FILE_NAME ]
then
@lancatlin
lancatlin / login-error.log
Last active March 3, 2019 00:17
Log of Elementary OS cannot login from TTY
3月 03 07:59:49 lancat-Notebook login[18395]: pam_unix(login:session): close_session - error recovering username
3月 03 07:59:49 lancat-Notebook login[18395]: pam_mail(login:session): cannot determine username
3月 03 07:59:49 lancat-Notebook login[18395]: TOO MANY LOGIN TRIES (5) on '/dev/tty1' FOR 'UNKNOWN'
3月 03 07:59:49 lancat-Notebook login[18395]: FAILED LOGIN (5) on '/dev/tty1' FOR 'UNKNOWN', Error in service module
3月 03 07:59:47 lancat-Notebook login[18395]: pam_securetty(login:auth): cannot determine username
3月 03 07:59:47 lancat-Notebook login[18395]: FAILED LOGIN (4) on '/dev/tty1' FOR 'UNKNOWN', Error in service module
3月 03 07:59:43 lancat-Notebook login[18395]: pam_securetty(login:auth): cannot determine username
3月 03 07:59:43 lancat-Notebook login[18395]: FAILED LOGIN (3) on '/dev/tty1' FOR 'UNKNOWN', Error in service module
3月 03 07:59:40 lancat-Notebook login[18395]: pam_securetty(login:auth): cannot determine username
3月 03 07:59:40 lancat-Notebook login[18395]: FAILED LOGIN (2) on
@lancatlin
lancatlin / .vimrc
Created February 2, 2019 13:40
My Vim configure
syntax enable
set number
set hlsearch
set cindent
"set expandtab
set tabstop=4
set cursorline
"set softtabstop=4
set shiftwidth=4
set confirm
@lancatlin
lancatlin / main.go
Created November 8, 2018 10:38
[Kata] Number of integer partitions
package kata
func Partitions(n int) int {
return p(n, n)
}
func p (n int, d int) int {
if d > n {
d = n
}
@lancatlin
lancatlin / database.ts
Created September 30, 2018 15:21
Database Interface and JSON Implements
import { readFileSync, writeFileSync } from "fs";
import { Struct } from "./struct";
const file_path :string = '/home/lancatlin/devlop/BookDatabase/data.json'
export enum DataType {
book = 'book',
member = 'member',
event = 'event'
}