Skip to content

Instantly share code, notes, and snippets.

@kindlychung
kindlychung / Dockerfile
Created January 21, 2024 12:30 — forked from ciiiii/Dockerfile
Postgresql for Chinese Full-Text Search.中文全文搜索
# If you don‘t want to build it youself, you can try `docker pull killercai/postgres`.
FROM healthcheck/postgres:latest
# China debian mirror
RUN sed -i s@/deb.debian.org/@/mirrors.aliyun.com/@g /etc/apt/sources.list
RUN apt-get clean && apt-get update
RUN apt-get install -y wget git build-essential libpq-dev python-dev postgresql-server-dev-all
# SCWS (Simple Chinese Word Segmentation library)
RUN cd /tmp && wget -q -O - http://www.xunsearch.com/scws/down/scws-1.2.1.tar.bz2 | tar xjf - && cd scws-1.2.1 && ./configure && make install
# zhpaser (postgres plugin)
@kindlychung
kindlychung / ! Mongo+TLS on Docker.md
Created August 30, 2023 21:18 — forked from nielsmaerten/! Mongo+TLS on Docker.md
MongoDB + MongoExpress over TLS on Docker

Secure MongoDB on Docker (incl MongoExpress, Let's Encrypt)

This gist contains files and instructions to setup MongoDB on a simple docker host.
Connections to Mongo are secured using TLS, and the certificate is signed using Let's Encrypt.
MongoExpress is included as well, but should only be used over an SSH tunnel.

  1. Update .env

  2. Make sure docker-compose is available

Required on GCP Cloud Optimized OS

# extracted from http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip
# under public domain terms
country_bounding_boxes = {
'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)),
'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)),
'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)),
'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)),
'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)),
'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)),
@kindlychung
kindlychung / tokio.rs
Created January 12, 2020 17:23 — forked from lolgesten/tokio.rs
futures::io::AsyncRead/AsyncWrite conversion to tokio::io::AsyncRead/AsyncWrite
use futures_io::{AsyncRead, AsyncWrite};
use std::fmt;
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
use tokio::io::AsyncRead as TokioAsyncRead;
use tokio::io::AsyncWrite as TokioAsyncWrite;
pub trait Stream: AsyncRead + AsyncWrite + Unpin + Send + 'static {}
@kindlychung
kindlychung / ld.gold.sh
Last active June 5, 2019 22:48 — forked from daniel-j-h/ld.gold.sh
default to ld.gold on Ubuntu'ish
sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.gold" 20
sudo update-alternatives --install "/usr/bin/ld" "ld" "/usr/bin/ld.bfd" 10
sudo update-alternatives --config ld
ld --version
GNU gold
export CPP=cpp-5 gcc-5 g++-5
env CXXFLAGS='-march=native -flto -fuse-linker-plugin' cmake .. -DCMAKE_BUILD_TYPE=Release
In file included from src/io/./iter_batchloader.h:16:0,
from src/io/io.cc:7:
src/io/././inst_vector.h:157:46: error: expected class-name before ‘{’ token
class TBlobContainer : public mshadow::TBlob {
^
src/io/././inst_vector.h:166:30: error: ‘TShape’ in namespace ‘mshadow’ does not name a type
void resize(const mshadow::TShape &shape, int type_flag) {
^
src/io/././inst_vector.h: In constructor ‘mxnet::io::TBlobContainer::TBlobContainer()’:
src/io/././inst_vector.h:160:21: error: expected class-name before ‘(’ token
@kindlychung
kindlychung / tensorflow_gpu_gce_ubuntu_zesty.sh
Last active October 30, 2017 14:54 — forked from jedisct1/tensorflow_gpu_gce_ubuntu_zesty.sh
Tensorflow 1.1 with CUDA 8.0 for GCE on Ubuntu 17.04
echo "deb [arch=amd64] http://storage.googleapis.com/bazel-apt stable jdk1.8" | sudo tee /etc/apt/sources.list.d/bazel.list
curl https://bazel.build/bazel-release.pub.gpg | sudo apt-key add -
cd /tmp # the next part is specific to your setup
# Get it here: https://developer.nvidia.com/cudnn
gsutil cp gs://tn-devel-ds/ubuntu/libcudnn5* .
ls libcudnn*.deb | sort | xargs sudo dpkg -i
sudo apt update
sudo apt install libopenblas-dev liblapack-dev python3-pip python3-pandas python3-venv python3-werkzeug
@kindlychung
kindlychung / build_lmms.sh
Created October 25, 2017 14:02 — forked from anonymous/build_lmms.sh
How to build lmms on ubuntu 17.10
git clone https://github.com/LMMS/lmms
cd lmms/
git checkout master
mkdir build target
cd build
sudo apt install libasound2-dev
sudo apt install libsndio-dev
sudo apt install libsndio-dev
sudo apt-get install libfftw3-dev
sudo apt-get install libfltk1.3-dev

Using Swift Package Manager with iOS

Step 1:

File > New > Project...

Step 2:

Create a Package.swift file in your root project directory, add dependencies, then run swift package fetch on the command line in the same directory. We’re not going to run swift build because it will just complain.

@kindlychung
kindlychung / compiles.rs
Last active September 13, 2016 20:40 — forked from anonymous/playground.rs
Shared via Rust Playground
#[derive(Debug)]
struct Foo<'a> {
x: &'a i32,
}
fn main() {
let y = &5;
{
let foo;
foo = Foo { x: y };