Skip to content

Instantly share code, notes, and snippets.

View jolks's full-sized avatar

John Lau jolks

View GitHub Profile
@jolks
jolks / ogd-in-sql.ipynb
Created March 8, 2023 04:10 — forked from MaxHalford/ogd-in-sql.ipynb
Online gradient descent written in SQL
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jolks
jolks / values_pointers.go
Created August 23, 2022 02:24 — forked from josephspurrier/values_pointers.go
Golang - Asterisk and Ampersand Cheatsheet
/*
********************************************************************************
Golang - Asterisk and Ampersand Cheatsheet
********************************************************************************
Also available at: https://play.golang.org/p/lNpnS9j1ma
Allowed:
--------
p := Person{"Steve", 28} stores the value
@jolks
jolks / marked-katex.js
Created January 14, 2020 07:10 — forked from tajpure/marked-katex.js
Support katex for marked.
const renderer = new marked.Renderer()
let originParagraph = renderer.paragraph.bind(renderer)
renderer.paragraph = (text) => {
const blockRegex = /\$\$[^\$]*\$\$/g
const inlineRegex = /\$[^\$]*\$/g
let blockExprArray = text.match(blockRegex)
let inlineExprArray = text.match(inlineRegex)
for (let i in blockExprArray) {
const expr = blockExprArray[i]
const result = renderMathsExpression(expr)
@jolks
jolks / gitflow-breakdown.md
Created October 1, 2019 09:57 — forked from JamesMGreene/gitflow-breakdown.md
A comparison of using `git flow` commands versus raw `git` commands.

Initialize

gitflow git
git flow init git init
  git commit --allow-empty -m "Initial commit"
  git checkout -b develop master

Connect to the remote repository

@jolks
jolks / OOCheatSheet.java
Last active June 10, 2019 04:53 — forked from john-science/OOCheatSheet.java
Java: an Objected Oriented Cheat Sheet
/**
* The basic class syntax.
*/
public class BasicClass {
public BasicClass() {
// This is the constructor.
}
@jolks
jolks / attributes.rb
Created April 21, 2019 03:38 — forked from lizthegrey/attributes.rb
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
@jolks
jolks / untitled.carbide.md
Last active September 15, 2016 06:45
untitled
@jolks
jolks / Dockerfile
Created August 1, 2016 03:53 — forked from yefim/Dockerrun.aws.json
Build a Docker image, push it to AWS EC2 Container Registry, then deploy it to AWS Elastic Beanstalk
# Example Dockerfile
FROM hello-world
@jolks
jolks / ng-radio-inputs.html
Created August 12, 2014 01:10
How to handle radio inputs under ng-repeat
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Example - example-ngValue-directive-production</title>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.3.0-beta.17/angular.min.js"></script>
</head>
<body ng-app="valueExample">
@jolks
jolks / parallel_operation_with_multiple_args.py
Last active April 6, 2016 12:39
Parallel operation with multiple arguments in Python
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from multiprocessing import Pool
import math
def f(x, y, z):
# (x + 2y)^z
return math.pow(x + 2*y, z)