Skip to content

Instantly share code, notes, and snippets.

Avatar
🍂
Improving the code, one commit at a time

Duc Hoa, Nguyen saikocat

🍂
Improving the code, one commit at a time
View GitHub Profile
@saikocat
saikocat / atomic_habits.md
Last active Jun 19, 2021
[Advice] Summary of Atomic Habits
View atomic_habits.md
View xar.Dockerfile
FROM debian:buster-slim AS builder
ARG XAR_VERSION=19.4.22
WORKDIR /src
RUN set -ex; \
apt-get update; \
apt-get install -y g++ curl cmake squashfs-tools; \
curl -L https://github.com/facebookincubator/xar/archive/${XAR_VERSION}.tar.gz | tar -zxv --strip-components=1 --directory .; \
View vim.md

Movements

  • Pressing j will move the cursor down 1 physical line.
  • Pressing gj will move the cursor down 1 displayed line.
  • Alt to `. is g;

Formating

  • Wrap lines after setting textwidth: in visual mode, gq
  • set shiftround

Searching

@saikocat
saikocat / howto.md
Created Jul 16, 2020
JGit and invalid private key
View howto.md
Caused by: com.jcraft.jsch.JSchException: invalid privatekey: [B@e4487af

The root cause was discovered to be the ssh private key mismatch. The exception only happened for users with key of newer kind ed25519, which outputs this key header:

-----BEGIN OPENSSH PRIVATE KEY-----
View SQLqns.md

The Best Medium-Hard Data Analyst SQL Interview Questions

Source

By Zachary Thomas (zthomas.nc@gmail.com, Twitter, LinkedIn)

**Tip: **See the Table of Contents (document outline) by hovering over the vertical line on the right side of the page

Background & Motivation

View OpenMined-PySyft-travis.yml
group: travis_latest
language: python
cache: pip
python:
#- 2.7
- 3.6
#- nightly
#- pypy
#- pypy3
matrix:
View fish_variables
# This file contains fish universal variable definitions.
# VERSION: 3.0
SETUVAR ZO_CMD:zo
SETUVAR Z_CMD:z
SETUVAR Z_DATA:/home/hoa/\x2elocal/share/z/data
SETUVAR Z_DATA_DIR:/home/hoa/\x2elocal/share/z
SETUVAR Z_EXCLUDE:/home/hoa
SETUVAR __fish_classic_git_prompt_initialized:\x1d
SETUVAR __fish_init_2_39_8:\x1d
SETUVAR __fish_init_2_3_0:\x1d
View conftest.py
# https://github.com/harterrt/cookiecutter-python-etl/blob/master/README.md#benefits
# https://github.com/mozilla/python_mozetl/tree/master/tests
import pytest
from pyspark.sql import SparkSession
import json
@pytest.fixture(scope="session")
def spark():
spark = (
View guava-14.0-vs-18.0-classloader.java
// Guava 14.0 - bundled with Spark
// https://github.com/google/guava/blob/v14.0/guava/src/com/google/common/io/Resources.java#L191
/**
* Returns a {@code URL} pointing to {@code resourceName} if the resource is
* found in the class path. {@code Resources.class.getClassLoader()} is used
* to locate the resource.
*/
public static URL getResource(String resourceName) {
URL url = Resources.class.getClassLoader().getResource(resourceName);
checkArgument(url != null, "resource %s not found.", resourceName);
@saikocat
saikocat / create_temp_binary.scala
Last active Oct 29, 2017
spark-shell, embedded-redis and ClassLoader
View create_temp_binary.scala
import java.util.EnumSet
import java.nio.file.{Files, Path, Paths}
import java.nio.file.StandardCopyOption
import java.nio.file.attribute.{PosixFilePermission, PosixFilePermissions}
// Exception handling omitted for brevity
def createTempRedisBinary(binaryName: String = "redis-server-2.8.19"): Path = {
val classLoader = Thread.currentThread.getContextClassLoader
val inputStream = classLoader.getResourceAsStream(binaryName)
val tempBinary = Files.createTempFile("binaryPrefix-", "-binarySuffix")