Skip to content

Instantly share code, notes, and snippets.

xmeng1 / TypeClassDemo.scala
Created Jun 18, 2019
Cats Type Class Demo
View TypeClassDemo.scala
// Define a very simple JSON AST
sealed trait Json
final case class JsObject(get: Map[String, Json]) extends Json
final case class JsString(get: String) extends Json
final case class JsNumber(get: Double) extends Json
case object JsNull extends Json
////////////////// Step 1
// The "serialize to JSON" behaviour is encoded in this trait
trait JsonWriter[A] {
kenjipm / workers.sql
Last active Nov 23, 2021
The following data definition defines an organization's employee hierarchy. An employee is a manager if any other employee has their managerId set to the first employees id. An employee who is a manager may or may not also have a manager. TABLE employees id INTEGER NOT NULL PRIMARY KEY managerId INTEGER REFERENCES employees(id) name VARCHAR(30) …
View workers.sql
SELECT name FROM employees
WHERE id NOT IN (SELECT managerId FROM employees WHERE managerId IS NOT NULL);
xmeng1 /
Last active Jun 21, 2018 — forked from seangtkelley/
Install Script for Gitkraken on Fedora 27 + Launcher Icon
# Enter /opt folder (common folder for user installed programs)
# This script assumes you have proper permissions on /opt
cd /home/mengxin/Applications
# Download GitKraken
# Extract the Kraken into /opt directory

Disabling GNOME Tracker and Other Info

GNOME's tracker is a CPU and privacy hog. There's a pretty good case as to why it's neither useful nor necessary here:

After discovering it chowing 2 cores, I decided to go about disabling it.


aelkz / [FEDORA] gitkraken
Last active Apr 1, 2022
How to install gitkraken on Fedora [25,26,27] + launcher icon
View [FEDORA] gitkraken
# Download GitKraken
# copy the downloaded file into /opt directory
cp gitkraken-amd64.tar.gz /opt/
cd /opt
welshstew /
Created Dec 9, 2016
sublime text 3 install
SHORTCUT="[Desktop Entry]
Name=Sublime Text 3
Comment=Edit text files
0xjac /
Last active Aug 13, 2022
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare

onjin / docker-compose.yml
Created Sep 5, 2016
example docker compose for postgresql with db init script
View docker-compose.yml
image: postgres:9.4
- ./init.sql:/docker-entrypoint-initdb.d/init.sql
daredude / docker-clear.bat
Created Jun 5, 2016
delete all docker container and images on windows
View docker-clear.bat
@echo off
FOR /f "tokens=*" %%i IN ('docker ps -aq') DO docker rm %%i
FOR /f "tokens=*" %%i IN ('docker images --format "{{.ID}}"') DO docker rmi %%i
import skimage;
from skimage import data
from skimage.filters import threshold_otsu
from skimage.segmentation import clear_border
from skimage.measure import label
from skimage.morphology import closing, square
from skimage.measure import regionprops
from skimage.color import label2rgb
import cv2
import numpy as np