Skip to content

Instantly share code, notes, and snippets.

View liongkj's full-sized avatar
🏫
Focusing

KJ liongkj

🏫
Focusing
View GitHub Profile
@liongkj
liongkj / gist:70c4ed21a9c9b1a58aa3f49c7d63ba94
Created August 11, 2025 07:20
proxyconnect tcp: dial tcp 127.0.0.1:7890: connect: connection refused
## Problem
When using Docker Desktop with WSL2 and Clash for Windows proxy, you may encounter this error:
```
target CONTAINER_NAME: failed to solve: python:3.12-slim: failed to resolve source metadata for docker.io/library/python:3.12-slim: failed to do request: Head "https://registry-1.docker.io/v2/library/python/manifests/3.12-slim": proxyconnect tcp: dial tcp 127.0.0.1:7890: connect: connection refused
```
## Solution
Follow these steps in order:
#!/bin/bash
echo "Setting up WeeRSS..."
# Check if either docker-compose or docker compose is available
if command -v docker-compose &> /dev/null; then
DOCKER_COMPOSE_CMD="docker-compose"
elif docker compose version &> /dev/null; then
DOCKER_COMPOSE_CMD="docker compose"
else
@liongkj
liongkj / dockerfile
Created December 25, 2022 15:31
installing pdftk-java in docker containers
FROM python:3.10
RUN apt-get update -y && software-properties-common && \
apt-add-repository 'deb http://security.debian.org/debian-security stretch/updates main' && apt update -y && \
apt-get install -y openjdk-8-jdk-headless
ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/
RUN wget https://gitlab.com/api/v4/projects/5024297/packages/generic/pdftk-java/v3.3.3/pdftk-all.jar
@liongkj
liongkj / compress_pdf.md
Created February 28, 2022 07:25 — forked from ahmed-musallam/compress_pdf.md
How to compress PDF with ghostscript

How to compress PDF using ghostscript

As a developer, it bothers me when someone sends me a large pdf file compared to the number of pages. Recently, I recieved a 12MB scanned document for just one letter-sized page... so I got to googlin, like I usually do, and found ghostscript!

to learn more abot ghostscript (gs): https://www.ghostscript.com/

What we are interested in, is the gs command line tool, which provides many options for manipulating PDF, but we are interested in compressign those large PDF's into small yet legible documents.

credit goes to this answer on askubuntu forum: https://askubuntu.com/questions/3382/reduce-filesize-of-a-scanned-pdf/3387#3387?newreg=bceddef8bc334e5b88bbfd17a6e7c4f9

@liongkj
liongkj / route_ssh_to_wsl.ps1
Created September 6, 2021 05:38
route_ssh_to_wsl
wsl.exe sudo /etc/init.d/ssh start
$wsl_ip = (wsl hostname -I).trim()
Write-Host "WSL Machine IP: ""$wsl_ip"""
netsh interface portproxy add v4tov4 listenport=65320 connectport=65320 connectaddress=$wsl_ip listenaddress=0.0.0.0
@liongkj
liongkj / command.sh
Last active May 26, 2022 09:32 — forked from zqqf16/IKEv2.mobileconfig
上海交大vpn Linux设置 strongSwan IKEv2 configurations for SJTU VPN
# Download strongSwan
wget https://download.strongswan.org/strongswan-5.9.3.tar.gz
# Extract and uncompress
tar -vzxf strongswan-5.9.3.tar.gz
cd strongswan-5.9.3
sudo apt install build-essential libgmp-dev libssl-dev
@liongkj
liongkj / gist:d852a05b0459aeb6349e5dbf40b94be9
Created July 25, 2020 06:59
Malaysia Phone number Regex without country code
^(?!61)(6?[60]?1{1})[0|1|2|3|4|6|7|8|9]\-*[0-9]{7,8}$
matched
0123456789
60123456789
123456789
@liongkj
liongkj / flutter dart cheatsheet
Created April 5, 2020 09:25
self reminder solution and syntax
##Error handling
try{}
a) catch (error) {}
b) on EXCEPTIONNAME catch (e){//handle}
class PlaceList extends StatefulWidget {
const PlaceList({
Key key,
@required this.index,
@required this.controller,
}) : super(key: key);
final int index;