Blog

  • vue-admin

    Vue-admin

    这是一个不简单的全栈后台管理系统。

    想法

    做一个全栈项目,可以发表文章,管理评论、用户、标签、文章、添加图片等类似于wordpress的项目,主要是学习mongoose操作mongodb数据库,学习一对多,多对多关系设计。

    由于工作量很大,将后期陆续完成。

    主要功能有:

    1. 首页 (一些文章新增,用户动态)
    2. 文章管理(文章列表+新增文章)
    3. 菜单管理(分配菜单)
    4. 角色管理(暂时只有两种用户:管理员+一般用户)
    5. 页面管理(后期新增一些模板,可以新增菜单链接相应页面)
    6. 文章标签管理
    7. 文章分类管理
    8. 用户管理

    技术栈

    • vue2
    • vuex
    • axios
    • vue-router
    • express
    • mongoose
    • iview
    • vue-echarts

    效果

    下载&安装

    git clone https://github.com/shawn2016/vue-admin.git
    cd vue-admin
    npm i

    运行

    npm start
    

    后台服务

    先启动mongodb服务:https://www.cnblogs.com/wzlblog/p/6364045.html)

    npm run server
    

    目录说明

    .
    
    ├── README.md
    ├── app.js #启动文件
    ├── beizhu.md #字段说明
    ├── build #vue-cli
       ├── build.js
       ├── check-versions.js
       ├── logo.png
       ├── utils.js
       ├── vue-loader.conf.js
       ├── webpack.base.conf.js
       ├── webpack.dev.conf.js
       └── webpack.prod.conf.js
    ├── config
       ├── db.js #mogodb地址
       ├── dev.env.js
       ├── index.js
       ├── prod.env.js
       └── test.env.js
    ├── index.html
    ├── package.json
    ├── router
       └── index.js #路由分发
    ├── server #后台服务层
       ├── DBhelper #公共sql方法
          └── dbHelper.js
       ├── DBsql #模型sql操作
          ├── articleDao.js
          ├── homeDao.js
          ├── menuDao.js
          ├── pageDao.js
          ├── roleDao.js
          └── userDao.js
       ├── controller #mvc中C层,做逻辑处理
          ├── articleManagementController.js
          ├── homeManagementController.js
          ├── menuManagementController.js
          ├── pageManagementController.js
          ├── roleManagementController.js
          └── userManagementController.js
       ├── models # mvc中m层,数据表模型
          ├── article.js
          ├── home.js
          ├── menu.js
          ├── page.js
          ├── role.js
          └── user.js
       └── utils
           ├── filterData.js # 返回格式处理
    ├── src #前台
       ├── App.vue
       ├── assets
          └── styles
       ├── components #公用组件
          ├── breadcrumb.vue #面包屑
          ├── bus.js #加载条
          ├── editor.vue #富文本编辑器
          ├── layout.vue #布局
          └── navcontent.vue #导航条
       ├── config
          ├── env.js
          ├── index.js
          └── mUtils.js
       ├── data # mock数据
          ├── bar.js
          ├── connect.js
          ├── logo.js
          ├── map.js
          ├── pie.js
          ├── polar.js
          ├── scatter.js
          └── theme.json
       ├── favicon.ico
       ├── filters #过滤器
          ├── commonFilter.js
          ├── date.js
          └── index.js
       ├── langs #富文本编辑器中文
          └── zh_CN.js
       ├── libs #请求方法与配置
          ├── baseUrl.js
          ├── fetch.js
          ├── tree
          └── util.js
       ├── main.js
       ├── pages #所有页面
          ├── articleManage #文章管理
          ├── home #首页
          ├── login # 登陆 注册 重置密码
          ├── menuManage #菜单管理
          ├── pageManage #页面管理
          ├── roleManage #角色管理
          └── userManage #用户管理
       ├── router #vue路由
          └── index.js
       ├── service #所有请求由这里发出
          ├── getData.js
          └── randomWord.js
       ├── skins #富文本编辑器
          └── lightgray
       └── store #vuex
           ├── action.js
           ├── getters.js
           ├── index.js
           ├── mutation-types.js
           └── mutations.js
    ├── static #静态资源
       ├── addArticle.png
       ├── article.png
       ├── dashboard.png
       └── updateArtilce.png
    ├── test 
        └── unit
            ├── jest.conf.js
            ├── setup.js
            └── specs

    tree 目录生成命令

    tree -L 3 -I "node_modules"
    
    brew install tree  ||  apt-get install tree
    
    - tree -d 只显示文件夹;
    - tree -L n 显示项目的层级。n表示层级数。比如想要显示项目三层结构,可以用tree -l 3;
    - tree -I pattern 用于过滤不想要显示的文件或者文件夹。比如你想要过滤项目中的node_modules文件夹,可以使用tree -I "node_modules";
    - tree > tree.md 将项目结构输出到tree.md这个文件。
    
    

    License

    Licensed under the MIT License.

    Visit original content creator repository https://github.com/shawn2016/vue-admin
  • vue-admin

    Vue-admin

    这是一个不简单的全栈后台管理系统。

    想法

    做一个全栈项目,可以发表文章,管理评论、用户、标签、文章、添加图片等类似于wordpress的项目,主要是学习mongoose操作mongodb数据库,学习一对多,多对多关系设计。

    由于工作量很大,将后期陆续完成。

    主要功能有:

    1. 首页 (一些文章新增,用户动态)
    2. 文章管理(文章列表+新增文章)
    3. 菜单管理(分配菜单)
    4. 角色管理(暂时只有两种用户:管理员+一般用户)
    5. 页面管理(后期新增一些模板,可以新增菜单链接相应页面)
    6. 文章标签管理
    7. 文章分类管理
    8. 用户管理

    技术栈

    • vue2
    • vuex
    • axios
    • vue-router
    • express
    • mongoose
    • iview
    • vue-echarts

    效果

    下载&安装

    git clone https://github.com/shawn2016/vue-admin.git
    cd vue-admin
    npm i

    运行

    npm start
    

    后台服务

    先启动mongodb服务:https://www.cnblogs.com/wzlblog/p/6364045.html)

    npm run server
    

    目录说明

    .
    
    ├── README.md
    ├── app.js #启动文件
    ├── beizhu.md #字段说明
    ├── build #vue-cli
       ├── build.js
       ├── check-versions.js
       ├── logo.png
       ├── utils.js
       ├── vue-loader.conf.js
       ├── webpack.base.conf.js
       ├── webpack.dev.conf.js
       └── webpack.prod.conf.js
    ├── config
       ├── db.js #mogodb地址
       ├── dev.env.js
       ├── index.js
       ├── prod.env.js
       └── test.env.js
    ├── index.html
    ├── package.json
    ├── router
       └── index.js #路由分发
    ├── server #后台服务层
       ├── DBhelper #公共sql方法
          └── dbHelper.js
       ├── DBsql #模型sql操作
          ├── articleDao.js
          ├── homeDao.js
          ├── menuDao.js
          ├── pageDao.js
          ├── roleDao.js
          └── userDao.js
       ├── controller #mvc中C层,做逻辑处理
          ├── articleManagementController.js
          ├── homeManagementController.js
          ├── menuManagementController.js
          ├── pageManagementController.js
          ├── roleManagementController.js
          └── userManagementController.js
       ├── models # mvc中m层,数据表模型
          ├── article.js
          ├── home.js
          ├── menu.js
          ├── page.js
          ├── role.js
          └── user.js
       └── utils
           ├── filterData.js # 返回格式处理
    ├── src #前台
       ├── App.vue
       ├── assets
          └── styles
       ├── components #公用组件
          ├── breadcrumb.vue #面包屑
          ├── bus.js #加载条
          ├── editor.vue #富文本编辑器
          ├── layout.vue #布局
          └── navcontent.vue #导航条
       ├── config
          ├── env.js
          ├── index.js
          └── mUtils.js
       ├── data # mock数据
          ├── bar.js
          ├── connect.js
          ├── logo.js
          ├── map.js
          ├── pie.js
          ├── polar.js
          ├── scatter.js
          └── theme.json
       ├── favicon.ico
       ├── filters #过滤器
          ├── commonFilter.js
          ├── date.js
          └── index.js
       ├── langs #富文本编辑器中文
          └── zh_CN.js
       ├── libs #请求方法与配置
          ├── baseUrl.js
          ├── fetch.js
          ├── tree
          └── util.js
       ├── main.js
       ├── pages #所有页面
          ├── articleManage #文章管理
          ├── home #首页
          ├── login # 登陆 注册 重置密码
          ├── menuManage #菜单管理
          ├── pageManage #页面管理
          ├── roleManage #角色管理
          └── userManage #用户管理
       ├── router #vue路由
          └── index.js
       ├── service #所有请求由这里发出
          ├── getData.js
          └── randomWord.js
       ├── skins #富文本编辑器
          └── lightgray
       └── store #vuex
           ├── action.js
           ├── getters.js
           ├── index.js
           ├── mutation-types.js
           └── mutations.js
    ├── static #静态资源
       ├── addArticle.png
       ├── article.png
       ├── dashboard.png
       └── updateArtilce.png
    ├── test 
        └── unit
            ├── jest.conf.js
            ├── setup.js
            └── specs

    tree 目录生成命令

    tree -L 3 -I "node_modules"
    
    brew install tree  ||  apt-get install tree
    
    - tree -d 只显示文件夹;
    - tree -L n 显示项目的层级。n表示层级数。比如想要显示项目三层结构,可以用tree -l 3;
    - tree -I pattern 用于过滤不想要显示的文件或者文件夹。比如你想要过滤项目中的node_modules文件夹,可以使用tree -I "node_modules";
    - tree > tree.md 将项目结构输出到tree.md这个文件。
    
    

    License

    Licensed under the MIT License.

    Visit original content creator repository https://github.com/shawn2016/vue-admin
  • acnh-villagers-tracking

    ACNH Villagers Tracking

    Static Badge Static Badge Static Badge Static Badge

    So my partner was struggling to kick out some villagers in their Animal Crossign New Horizons island.

    They followed an strategy that was basically checking out every villager to see which one has a thought bubble. They also had to keep count of how many days passed without a bubble, or without a new visit in the campfire.

    To help them accomplish it, I made this little tool with the icons of their villagers.

    You can visit it on its GitHub Page

    How to use it

    The idea is simple: you see your villager in-game, and if it doesn’t have any thought bubble, you click or tap on its icon on the tool, and keep going. If anybody has it, add one to the counter on the left. Additionaly, if nobody came to the campfire that day, you add one to the counter on the right.

    Some things to consider

    You can use it on the phone too, since it has a mobile version too.

    This tool doesn’t save any kind of data, not even cache. So any refresh would reset the counters and the villagers markdowns. It’s a really simple tool that I made quickly, and my partner was happy it was useful, and so was I.

    Visit original content creator repository https://github.com/brisaAbrasadora/acnh-villagers-tracking
  • acnh-villagers-tracking

    ACNH Villagers Tracking

    Static Badge Static Badge Static Badge Static Badge

    So my partner was struggling to kick out some villagers in their Animal Crossign New Horizons island.

    They followed an strategy that was basically checking out every villager to see which one has a thought bubble. They also had to keep count of how many days passed without a bubble, or without a new visit in the campfire.

    To help them accomplish it, I made this little tool with the icons of their villagers.

    You can visit it on its GitHub Page

    How to use it

    The idea is simple: you see your villager in-game, and if it doesn’t have any thought bubble, you click or tap on its icon on the tool, and keep going. If anybody has it, add one to the counter on the left. Additionaly, if nobody came to the campfire that day, you add one to the counter on the right.

    Some things to consider

    You can use it on the phone too, since it has a mobile version too.

    This tool doesn’t save any kind of data, not even cache. So any refresh would reset the counters and the villagers markdowns. It’s a really simple tool that I made quickly, and my partner was happy it was useful, and so was I.

    Visit original content creator repository https://github.com/brisaAbrasadora/acnh-villagers-tracking
  • Py_Matrix

    Py_Matrix

    Module for matrix creation and matrix manipulation. Programming Language: Python.

    image

    Project Repository on GitHub: https://github.com/MatteoLiotta/Py_Matrix
    Author: Matteo Liotta, 2022
    File: Py_Matrix.py
    License: License

    LIST OF FUNCTIONS:

    Matrix
    • .matrix_c([elements], rows, columns):
      creates a matrix from a selected (if not, uses the self.v) dataset, number of rows and columns (if not selected, it uses self.r and self.c)
    • .__str__():
      print in a pretty and comprehensible way the matrix.
    • .elem(i,j):
      Return a specific element of the matrix. User has to choose row and column, then the element in that row and column is returned.
    • .elem_change(i,j, value):
      It changes a specific element of the matrix. User has to choose row and column, then the element in that row and column is changed whit the entered value. It is also possible to refer to the matrix as self.matrix[i][j], whitout using this function.
    • .__add__():
      It makes possible to add two differents matrix. It return a new matrix, istance of Matrix class. Matrix must have same rows and columns [it returns a new Matrix object]
    • .__mul__():
      Two possibilities: if ‘other’ is a number or if it is a matrix.
      • if other is a matrix, it uses the rule for this operation. So the operation returns the matrix obtained with the multiplication between matrix.
      • if other is not a matrix, but an integer or a floating point number, it multiplies every element of the matrix for the number. [it returns a new Matrix object]
    • .t():
      The function returns a new matrix which is the transpose of the given matrix. The transpose matrix is define by definition as: With A as a matrix (Aij), A.t() is (tAij), so: tAij = Aji So the transpose switches the index of the original matrix. The new matrix is returned. Original matrix is not changed.
    • .elementary_op1(row1, row2):
      The function returns a Matrix where row1 and row2 of self are switched. It is the first elementary operation.
    • .change_col(col1, col2):
      The function returns a Matrix where col1 and col2 of self are switched. It is the first elementary operation on columns.
    • .rotate():
      This funtion returns a Matrix rotated by 90 degrees counterclockwise.
    • .elementary_op2(row, value):
      The function returns a Matrix where row1 of self is multiplied by a chosen number. It is the second elementary operation.
    • .elementary_op3(rowtochange, row, value):
      The function returns a Matrix where every element of rowtochange is added with a multiple (val) of the row entered. Value is required. It is the third elementary operation.
    • .sub(i,j):
      The function returns the submatrix obtained deleting the row “rowdeleted” and the column “column_deleted”. The matrix avoid taking elements with row_deleted or column deleted ad indices. The submatrix number of row and coulmns is, if nxn, the sqrt of the number of rows (so elements of matrix list). If mxn, it is the number of rows and columns – 1. To unify cases, it will all be done in the second way.
    • det_nxn(Matrix):
      The function returns the determinant of a matrix. The determinant is recursively obtained using Laplace Formula, as sum of multiplication between elements (i,j) and the cofactor(i,j). In case of a 1×1 matrix, is returned the element (0,0) of the matrix.
    • .cofactor(i,j):
      The function returns the cofactor of a matrix, using definition.
    • .cof_matrix():
      The function returns the cofactor of a matrix, using definition.
    • .inverse():
      Using the definition for the inverse of a matrix (tcof(A)*1/detA), the function returns the inverse of the matrix.
    • switch_columns(A,B,column1, column2):
      The function returns a matrix where the column_A of A is switched with columns_from_B of the matrix B
    • cramer_rule(Matrix, Matrix):
      For linear systems with square system matrix, without using invert matrix. Used the definition of the Cramer Rule for linear systems.
    • square_linear_systems(Matrix, Matrix):
      Use the function if you have to solve a linear system where A matrix of the system is a square matrix. It uses the definition: X = A^-1*B. The vector that solves the system is returned.
    • .export():
      The function prints the matrix definition in a usefull common format
    • .info():
      The function prints all relevant informations about the matrix:
      • rows
      • columns
      • transpose
      • if square
        • determinant
        • inverse matrix
        • cofactor matrix
    • .__iter__():
      The function let the matrix be iterable
    • .__next__():
      The function update the iterator and return the element self.elem(i,j)
    • len(Matrix):
      The function returns the number of elements in the Matrix
    • .find_pivot(row):
      The function returns the pivot of a selected row. A pivot is the first element != 0 of a row.
      WARNING: i and j are not in the usual order. It is because i need to sort the list in other methods.
    • .pivot_list():
      The function return a list with all the pivots of the matrix and their indices. Example: [(j, i, val), (j2,i2, val2)…]
      WARNING: i and j are not in the usual order. It is because i need to sort the list in other methods.
    • .is_triangular():
      Check if the Matrix is or not triangular | Being triangular means that the pivot in a low j must be in low i. It is not triangular if pivot are on the same column.
    • .sort():
      The function sort the matrix in order to make it triangular
    • .pivot_before(row):
      The function returns True if the pivot in the previous row is in the same column of the pivot of the selected row. Else: False.
    • .gaussian_elimination():
      The function returns a matrix where it was done the Gaussian Elimination.
    • .from_num_to_str(self):
      Method to convert a Matrix in a String Matrix
    • .characteristic_polynomial():
      Method that returns the str version of the C. Poly. from a Numerical Matrix.
    • antidiagonal_1(dimension):
      This function takes the dimension of the output matrix in order to create an antidiagonal matrix of all 1.
    String_Matrix
    • .__add__(self, other):
      The function returns a string Matrix where the elements are the sum of the strings, with “+” Example: “3”+”+”+”4″ –> “3+4”
    • .sub(self, row_deleted, column_deleted):
      The function returns a string sub matrix.
    • .characteristic_polynomial(self):
      The function returns the Char. Polynomial of a string matrix. It is required a string Matrix, in order to let there be variables. The function is returned as a string.
    • .check_C_Poly(self):
      A function used for testing
    • .from_str_to_num(self):
      Method to convert a String Matrix in a Matrix
    • str_det_nxn(mat, row, col):
      Determinant of a string matrix. It returns a string, using the Laplace Formula.

    SAMPLES:

    1. Import the module:

      >>> import Py_Matrix as py_m 
      
    2. Create a Matrix from a dataset:

      >>> A = py_m.Matrix([1,2,3,4], 2, 2)
      
    3. Print a Matrix:

      >>> A = py_m.Matrix([1,2,3,4], 2, 2)
      >>> print(A)
      

      Output:

      0| 1     2     
      1| 3     4     
         --    --
         0     1
      
    4. Print an element of the matrix, with row and column:

      >>> print(A.elem(1,0) #A previously declared
      

      Output:

      3
      
    5. Add two Matrix (Matrix + Matrix):

      WARNING: Matrix must have same rows and columns

      >>> A = py_m.Matrix([1,2,3,4], 2, 2) 
      >>> B = py_m.Matrix([4,3,2,1], 2, 2) 
      >>> print(A+B) 
      

      Output:

      0| 5     5     
      1| 5     5     
         --    --
         0     1
      
    6. Matrix * Matrix:

      WARNING: Matrix multiplication is not commutative

      >>>print(A*B) #A and B previously declared
      

      Output:

      0| 8     5     
      1| 20    13    
         --    --
         0     1
      
    7. Matrix * number:

      WARNING: 2*A is not implemented.

      >>> print(A*2) #A and B previously declared
      

      Output:

      0| 2     4     
      1| 6     8     
         --    --    
         0     1  
      
    8. Transpose of a Matrix:

      >>> print(A.t()) #A previously declared
      

      Output:

      0| 1     3     
      1| 2     4     
         --    --    
         0     1 
      
    9. Elementary operation 3:

      >>> A.elementary_op3(0,1,-3)
      

      Output:

      0| 1     2     
      1| 0     -2    
         --    --    
         0     1
      
    10. Submatrix of a matrix:

      >>> print(A.sub(0,0)) #A previously declared
      

      Output:

      0| 4       
         --   
         0
      
    11. Determinant of a matrix (2 ways)

      >>> print(A.det) #it returns determinant as a number
      >>> print(det_nxn(A)) #it returns determinant as a number
      

      Output:

      -2
      
    12. Cofactor of a Matrix:

      deleting the element in (0,0)

      >>> print(A.cofactor(0,0)) #A previously declared
      

      Output:

      4
      
    13. Inverse Matrix:

      >>> print(A.inverse()) #A previously declared 
      

      Output:

      0| -2.000 1.000 
      1| 1.500 -0.500 
         --    --    
         0     1  
      
    14. Cramer Rule on Linear System:

      >>> B = py_m.Matrix([4,3],2,1) 
      >>> print(cramer_rule(A,B)) #A previously declared
      
    15. Matrix Informations:

      >>> A.info() #A previously declared
      
    16. Matrix iteration:

      >>> A = py_m.Matrix([1,2,3,4,5,6],2,3)
      >>> for i in A:
              print(i)
      

      Output:

      1
      2
      3
      4
      
    17. Lenght:

      >>> print(len(A)) #A previously declared as Matrix([1,2,3,4],2,2)
      

      Output:

      4
      
    18. Find Pivot:

      >>> print(A) #A previously declared as Matrix([1,2,0,4],2,2)
      

      Output:

      0| 1     2     
      1| 0     4    
         --    --    
         0     1
      
      >>> print(A.find_pivot(1)) 
      

      Output:

      4
      
    19. Pivot List:

      >>> A = py_m.Matrix([1,2,3,4], 2, 2)
      >>> print(A.pivot_list())
      

      Output:

      [(0, 0, 1), (0, 1, 3)]
      
    20. Sort a Matrix:

      >>> A = py_m.Matrix([0,1,3,4], 2, 2)
      >>> print(A.sort())
      

      Output:

      0| 3     4     
      1| 0     1     
         --    --    
         0     1
      
    21. Gaussian Elimination:

      >>> A = py_m.Matrix([0,1,3,4], 2, 2)
      >>> print(A.gaussian_elimination())
      

      Output:

      0| 5     1     3     
      1| 0.000 2.600 -3.200 
      2| 0.000 0.000 -7.077 
         --    --    --    
         0     1     2   
      
    22. Characteristic Polynomial:

      >>> A = py_m.Matrix([0,1,3,4], 2, 2)
      >>> print(A.characteristic_polynomial())
      

      Output:

      (((0-x)*(4-x))+(-3))
      
    23. Rotate a Matrix counterclockwise:

      >>> A = py_m.Matrix([0,1,3,4], 2, 2)
      >>> print(A.rotate())
      

      Output:

      0| 1     4
      1| 0     3
         --    --
         0     1
      
    Visit original content creator repository https://github.com/MatteoLiotta/Py_Matrix
  • sql2parquet_py

    Project report: https://github.com/rohitxsh/ensembl_lakehouse_ui/blob/main/README.md

    Python script to move data from SQL to parquet files | GSoC ’22

    Recommended: Python 3.9.x
    Run the script via

    • Command line:
    1. Setup your AWS keys as explained here: https://boto3.amazonaws.com/v1/documentation/api/latest/guide/quickstart.html#configuration (config. location path: ~/.aws/ [~ -> Root directory])
    2. Run the script via python3 -m sql2parquet.main
    • Dockerfile:
    1. Update your AWS keys in .aws/credentials [.aws directory should be in same directory as the Dockerfile]
    2. Build the image from the dockerfile via docker build --tag sql2parquet .
    3. Run the container via docker run -d --name sql2parquet sql2parquet

    config.toml schema:

    [[databases]]
    location = "string, DB server address"
    port="string, DB server's port no."
    DB_USER="string, username to access the specified DB server"
    [[databases.species]]
    DBname="string, DB name"
    species="string, species scientific name"
    [[databases.tables]]
    table = "string, table name"
    query = '''
    milti-line string, SQL query to construct the table, variables can we used that are defined in vars
    '''
    

    Supported DB: MySQL
    Engine: PyMySQL


    .aws configuration files content for reference:

    config
    [default]
    region=eu-west-2

    credentials
    [default]
    aws_access_key_id = YOUR_ACCESS_KEY
    aws_secret_access_key = YOUR_SECRET_KEY

    Visit original content creator repository
    https://github.com/rohitxsh/sql2parquet_py

  • arduino-libraries

    Arduino compatible libraries

    Note: Unless otherwise specified, the libraries are distributed under the terms of GNU General Public License version 3.

    Display

    TM1628 (TM1628ts)

    A 7-Segment LED Driver from Titan Microelectronics Co.,Ltd. Library for a DVD player front panel (TeleSystem TS5.9RX). Uses a serial protocol similar to SPI. Information and examples.

    TM1628 panel segments

    SC75823

    13-Segment LCD Driver from Silan Microelectronics Co.,Ltd. Used in the front panel of a car radio & CD player. Information and examples.

    SC75823 panel segments

    HT16515

    15-Segment VFD Driver from Holtek Semiconductor Inc. Used with Futaba Corporation FV865ND VFD panel for a satellite receiver. Information and examples.

    HT16515 with FV865ND

    HX8347-I (Truly_HX8347I)

    LCD driver from Himax Technologies, Inc. Integrated in Truly International Holdings, Ltd. TFT3P5026-E 320×240 color TFT 2.8″ display. Used at front panel of Sercomm SHG1500 router (hardware revision LCDv6). Front panel has 2×15 pin 1.27 mm pinheader connector. Display uses SPI protocol (write only, no MISO). Includes backlight control. Information and examples. Backlight only library is TrulyBacklight (not needed anymore).

    SHG1500 Front Panel

    Device Control

    MxL5007T

    An integrated VHF/UHF tuner from MaxLinear, Inc. Taken from a DVB-T receiver and placed in a metallic box from a broken tuner. Information and examples.

    MxL5007T tuner

    SX8646

    Ultra Low Power, Capacitive Button Touch Controller (8 sensors) with Enhanced LED Drivers from Semtech Corporation. Found on the front panel keypad of Sercomm SHG1500 routers. Information and examples.

    SX8646 button panel

    Visit original content creator repository https://github.com/onetransistor/arduino-libraries
  • Fract-ol

    Fract’ol

    Fract'ol

    Fract’ol is a School 42 project. The purpose of this project is to create fractal renderer.

    Note that macOS is only supported.

    fract_ol.en.pdf is the task file.

    Wiki

    You can check wiki-pages if you want to read detailed explanations and tips. Wiki-pages were written in Russian.

    How to clone?

    This repository includes submodule. So if you want to clone it, you can use the following command:

    git clone --recurse-submodules <repository url>
    

    If you will use git clone <repository url> instead of, you will get the empty libft folder.

    Installation

    Clone repository and then go into the created directory and run the following command:

    make
    

    How to run program?

    You can run the project with the following command:

    ./fractol <name>
    

    For example, you can specify Mandelbrot fractal:

    ./fractol Mandelbrot
    

    Mandelbrot

    Multi-window mode is also supported. For example, you can run the following command to launch two windows:

    ./fractol <name> <name>
    

    You can specify up to 10 fractal names for one launch.

    There are available the following fractals:

    • Mandelbrot
    • Julia
    • Burning Ship
    • Mandelbar
    • Celtic Mandelbrot
    • Celtic Mandelbar
    • Celtic Perpendicular
    • Perpendicular Mandelbrot
    • Perpendicular Burning Ship
    • Perpendicular Buffalo

    Note that for a-few-word names you must use quotes:

    ./fractol "Perpendicular Burning Ship"
    

    Controls

    You can use H key for the help menu which contains a list of controls.

    Controls

    Visit original content creator repository https://github.com/VBrazhnik/Fract-ol
  • dlist

    Difference Lists

    test-badge hackage-badge packdeps-badge

    List-like types supporting O(1) append and snoc operations.

    Installation

    dlist is a Haskell package available from Hackage. It can be installed with cabal or stack.

    See the change log for the changes in each version.

    Usage

    Here is an example of “flattening” a Tree into a list of the elements in its Leaf constructors:

    import qualified Data.DList as DList
    
    data Tree a = Leaf a | Branch (Tree a) (Tree a)
    
    flattenSlow :: Tree a -> [a]
    flattenSlow = go
      where
        go (Leaf x) = [x]
        go (Branch left right) = go left ++ go right
    
    flattenFast :: Tree a -> [a]
    flattenFast = DList.toList . go
      where
        go (Leaf x) = DList.singleton x
        go (Branch left right) = go left `DList.append` go right

    (The above code can be found in the benchmark.)

    flattenSlow is likely to be slower than flattenFast:

    1. flattenSlow uses ++ to concatenate lists, each of which is recursively constructed from the left and right Tree values in the Branch constructor.

    2. flattenFast does not use ++ but constructs a composition of functions, each of which is a “cons” introduced by DList.singleton ((x :)). The function DList.toList applies the composed function to [], constructing a list in the end.

    To see the difference between flattenSlow and flattenFast, consider some rough evaluations of the functions applied to a Tree:

    flattenSlow (Branch (Branch (Leaf 'a') (Leaf 'b')) (Leaf 'c'))
      = go (Branch (Branch (Leaf 'a') (Leaf 'b')) (Leaf 'c'))
      = go (Branch (Leaf 'a') (Leaf 'b')) ++ go (Leaf 'c')
      = (go (Leaf 'a') ++ go (Leaf 'b')) ++ "c"
      = ("a" ++ "b") ++ "c"
      = ('a' : [] ++ "b") ++ "c"
      = ('a' : "b") ++ "c"
      = 'a' : "b" ++ "c"
      = 'a' : 'b' : [] ++ "c"
      = 'a' : 'b' : "c"
    flattenFast (Branch (Branch (Leaf 'a') (Leaf 'b')) (Leaf 'c'))
      = toList $ go (Branch (Branch (Leaf 'a') (Leaf 'b')) (Leaf 'c'))
      = toList $ go (Branch (Leaf 'a') (Leaf 'b')) `append` go (Leaf 'c')
      = unsafeApplyDList (go (Branch (Leaf 'a') (Leaf 'b'))) . unsafeApplyDList (go (Leaf 'c')) $ []
      = unsafeApplyDList (go (Branch (Leaf 'a') (Leaf 'b'))) (unsafeApplyDList (go (Leaf 'c')) [])
      = unsafeApplyDList (go (Branch (Leaf 'a') (Leaf 'b'))) (unsafeApplyDList (singleton 'c') [])
      = unsafeApplyDList (go (Branch (Leaf 'a') (Leaf 'b'))) (unsafeApplyDList (UnsafeDList ((:) 'c')) [])
      = unsafeApplyDList (go (Branch (Leaf 'a') (Leaf 'b'))) "c"
      = unsafeApplyDList (UnsafeDList (unsafeApplyDList (go (Leaf 'a')) . unsafeApplyDList (go (Leaf 'b')))) "c"
      = unsafeApplyDList (go (Leaf 'a')) (unsafeApplyDList (go (Leaf 'b')) "c")
      = unsafeApplyDList (go (Leaf 'a')) (unsafeApplyDList (singleton 'b') "c")
      = unsafeApplyDList (go (Leaf 'a')) (unsafeApplyDList (UnsafeDList ((:) 'b')) "c")
      = unsafeApplyDList (go (Leaf 'a')) ('b' : "c")
      = unsafeApplyDList (singleton 'a') ('b' : "c")
      = unsafeApplyDList (UnsafeDList ((:) 'a')) ('b' : "c")
      = 'a' : 'b' : "c"

    The left-nested ++ in flattenSlow results in intermediate list constructions that are immediately discarded in the evaluation of the outermost ++. On the other hand, the evaluation of flattenFast involves no intermediate list construction but rather function applications and newtype constructor wrapping and unwrapping. This is where the efficiency comes from.

    Warning! Note that there is truth in the above, but there is also a lot of hand-waving and intrinsic complexity. For example, there may be GHC rewrite rules that apply to ++, which will change the actual evaluation. And, of course, strictness, laziness, and sharing all play a significant role. Also, not every function in the dlist package is the most efficient for every situation.

    Moral of the story: If you are using dlist to speed up your code, check to be sure that it actually does. Benchmark!

    Design Notes

    These are some notes on design and development choices made for the dlist package.

    Avoid ++

    The original intent of Hughes’ representation of lists as first-class functions was to provide an abstraction such that the list append operation found in functional programming languages (and now called ++ in Haskell) would not appear in left-nested positions to avoid duplicated structure as lists are constructed. The lesson learned by many people using list over the years is that the append operation can appear, sometimes surprisingly, in places they don’t expect it.

    One of our goals is for the dlist package to avoid surprising its users with unexpected insertions of ++. Towards this end, there should be a minimal set of functions in dlist in which ++ can be directly or indirectly found. The list of known uses of ++ includes:

    • DList: fromList, fromString, read
    • DNonEmpty: fromList, fromNonEmpty, fromString, read

    If any future requested functions involve ++ (e.g. via fromList), the burden of inclusion is higher than it would be otherwise.

    Abstraction

    The DList representation and its supporting functions (e.g. append, snoc, etc.) rely on an invariant to preserve its safe use. That is, without this invariant, a user may encounter unexpected outcomes.

    (We use safety in the sense that the semantics are well-defined and expected, not in the sense of side of referential transparency. The invariant does not directly lead to side effects in the dlist package, but a program that uses an unsafely generated DList may do something surprising.)

    The invariant is that, for any xs :: DList a:

    fromList (toList xs) = xs

    To see how this invariant can be broken, consider this example:

    xs :: DList a
    xs = UnsafeDList (const [])
    
    fromList (toList (xs `snoc` 1))
      = fromList (toList (UnsafeDList (const []) `snoc` 1))
      = fromList (toList (UnsafeDList (unsafeApplyDList (UnsafeDList (const [])) . (x :))))
      = fromList (toList (UnsafeDList (const [] . (x :))))
      = fromList (($ []) . unsafeApplyDList $ UnsafeDList (const [] . (x :)))
      = fromList (const [] . (x :) $ [])
      = fromList (const [] [x])
      = fromList []
      = UnsafeDList (++ [])

    The invariant can also be stated as:

    toList (fromList (toList xs)) = toList xs

    And we can restate the example as:

    toList (fromList (toList (xs `snoc` 1)))
      = toList (UnsafeDList (++ []))
      = []

    It would be rather unhelpful and surprising to find (xs `snoc` 1) turned out to be the empty list.

    To preserve the invariant on DList, we provide it as an abstract type in the Data.DList module. The constructor, UnsafeDList, and record label, unsafeApplyDList, are not exported because these can be used, as shown above, to break the invariant.

    All of that said, there have been numerous requests to export the DList constructor. We are not convinced that it is necessary, but we are convinced that users should decide for themselves.

    To use the constructor and record label of DList, you import them as follows:

    import Data.DList.Unsafe (DList(UnsafeDList, unsafeApplyDList))

    If you are using Safe Haskell, you may need to add this at the top of your module:

    {-# LANGUAGE Trustworthy #-}

    Just be aware that the burden of proof for safety is on you.

    References

    These are various references where you can learn more about difference lists.

    Research

    • A novel representation of lists and its application to the function “reverse.” John Hughes. Information Processing Letters. Volume 22, Issue 3. 1986-03. Pages 141-144. PDF

      This is the original published source for a representation of lists as first-class functions.

    Background

    Blogs and Mailing Lists

    Books

    License

    BSD 3-Clause “New” or “Revised” License © Don Stewart, Sean Leather, contributors

    Visit original content creator repository https://github.com/spl/dlist
  • d-music-shop

    ethereum-player-image

    d-music-shop

    This project demonstrates how to build a decentralized application (dApp) for managing and selling digital music albums on a test blockchain.
    This project highlights the interaction between a frontend built in TypeScript and a backend based on Solidity smart contracts. The primary focus of the project is to illustrate how to seamlessly connect a blockchain backend with a frontend using TypeScript.

    Table of Contents

    Theory Notes

    How does blockchain and frontend interact?

    In this project, the frontend communicates with the blockchain through smart contracts deployed on the blockchain. The frontend uses the Ethereum provider (such as MetaMask) to send transactions and interact with the blockchain. The state of the blockchain is queried to display real-time information on the frontend, such as the list of available albums, order status, and user account balances.

    What is TypeChain?

    TypeChain is a tool that generates TypeScript typings for Ethereum smart contracts. It helps in ensuring type safety in a dApp by creating strongly typed contract interfaces. In this project, TypeChain is used to generate TypeScript types from the Solidity contract ABI files, making it easier to interact with the smart contracts from the TypeScript-based frontend.

    Features and Functionality

    • Album Management: Allows the owner to add new albums with details such as title, price, and quantity.
    • Purchasing Albums: Users can purchase albums by sending the exact required amount of Ether.
    • Order Tracking: The smart contract tracks the state of orders, from payment to delivery.
    • User Account Management: Displays user account information, including the connected wallet address and balance.

    Implementation

    Blockchain Contract Overview

    The smart contracts in this project manage the lifecycle of albums and orders. The AlbumTracker contract handles the creation, payment, and delivery of albums, while the MusicShop contract manages the listing of albums and tracks customer orders. These contracts use Solidity’s event system to emit logs that the frontend can listen to in order to update the UI in real time.

    Frontend Overview

    The frontend of the “d-music-shop” is built with React and TypeScript. It interacts with the smart contracts via the Ethers.js library and TypeChain-generated types. Users can connect their Ethereum wallet, view available albums, purchase albums, and track their orders through an intuitive interface.

    image-of-an-application

    Running the Project Locally

    To run the project locally, follow these steps:

    1. Clone the repository and navigate to the project directory:
      git clone https://github.com/sssshefer/d-music-shop.git
      cd d-music-shop
    2. Start a local blockchain node:
    npx hardhat node
    1. Deploy the contracts to the local network: Open another terminal and run:
    npx hardhat run deploy/deploy.ts --network localhost
    1. (Optional) Generate TypeScript types for smart contracts using TypeChain:
    npx typechain --target ethers-v6 --out-dir ./front/src/typechain "artifacts/contracts/**/*[!dbg].json"
    1. Start the frontend development server:
    npm run dev

    You should now be able to access the dApp in your browser at http://localhost:3000.


    Happy Hacking

    Visit original content creator repository https://github.com/sssshefer/d-music-shop