Skip to content

Instantly share code, notes, and snippets.

@eungju
eungju / I18n.kt
Last active March 28, 2024 14:19
Simple i18n
interface I18n {
fun localized(languageTag: String): Localized
interface Localized {
fun text(key: String, args: Map<String, Any>): String
fun text(key: String): String = text(key, emptyMap())
}
}
@akrylysov
akrylysov / README.md
Last active May 2, 2024 13:28
Fast Intel-on-ARM Docker on macOS with Lima and Rosetta

macOS 13 Ventura introduced support of running amd64 binaries with Rosetta inside of arm64 Linux VMs when using Apple Virtualization framework.

Lima VM v0.14.0 and later support the new feature.

Setup:

# Install Docker client and Lima
brew install docker docker-compose docker-credential-helper lima
@mytory
mytory / make-url-clickable-without-a-tag.php
Last active October 19, 2021 13:13
URL을 링크로 바꿔 주는데, 이미 링크가 걸린 a 태그는 건드리지 않는다.
<?php
/**
* 아래는 참고한 자료.
* @link https://stackoverflow.com/questions/24651869/regex-matching-links-without-a-tag/24653720?stw=2#24653720
*/
function make_link_clickable($text)
{
return preg_replace(
'!<a(.|\n)*?</a>(*SKIP)(*F)|' //skip a tag
. '(((f|ht)tp(s)?://)[-a-zA-Zа-яА-Я()0-9@:%_+.~#?&;/=]+)!i',
@joepie91
joepie91 / es-modules-are-terrible-actually.md
Last active April 26, 2024 13:33
ES Modules are terrible, actually

ES Modules are terrible, actually

This post was adapted from an earlier Twitter thread.

It's incredible how many collective developer hours have been wasted on pushing through the turd that is ES Modules (often mistakenly called "ES6 Modules"). Causing a big ecosystem divide and massive tooling support issues, for... well, no reason, really. There are no actual advantages to it. At all.

It looks shiny and new and some libraries use it in their documentation without any explanation, so people assume that it's the new thing that must be used. And then I end up having to explain to them why, unlike CommonJS, it doesn't actually work everywhere yet, and may never do so. For example, you can't import ESM modules from a CommonJS file! (Update: I've released a module that works around this issue.)

And then there's Rollup, which apparently requires ESM to be u

Table definition

CREATE TABLE countries (
  id INT NOT NULL AUTO_INCREMENT,
  iso VARCHAR(2) NOT NULL,
  iso3 VARCHAR(3) NOT NULL,
  iso_numeric INT NOT NULL,
  country_name VARCHAR(64) NOT NULL,
 capital VARCHAR(64) NOT NULL,
@avoidik
avoidik / README.md
Created April 24, 2021 18:16
How to Limit CPU and Memory Usage With Cgroups on Debian/Ubuntu

How to Limit CPU and Memory Usage With Cgroups on Debian/Ubuntu

Cgroups is a flexible Linux kernel feature to limit, police and account resources usage. A cgroup is a set of tasks for a subsystems, that is typically a resource controller.

A file system of type cgroup is mounted and all operations are run over it.

Installation

The installation can be done using any of libcgroup, cgmanager or systemd.

@mrtns
mrtns / README.md
Last active February 13, 2023 14:26
Data Landscape 2021

201x BI tools

SaaS

Acquired

  • BIME
    • Acquired by Zendesk October 2015
@usametov
usametov / topics-search.txt
Created February 16, 2021 01:50
how to search github.com for multiple topics
Github.com ui .currently does not natively supoport search for multiple topic tags as of now. However their api allows you to query multiple tags. Below is a simple example to query github.com with ecs and go topic tags.
curl -H "Accept: application/vnd.github.mercy-preview+json" \
https://api.github.com/search/repositories?q=topic:ecs+topic:go
Response from the github can be rather verbose so lets filter only relavant info such repo url and description.
curl -H "Accept: application/vnd.github.mercy-preview+json" \
https://api.github.com/search/repositories\?q\=topic:ecs+topic:go | jq '.items[] | {url:.url, description:.description}'
@progrium
progrium / README.md
Last active April 7, 2024 21:42
Setting up M1 Macs for x86 development with Homebrew

Key Points

  • In general, binaries built just for x86 architecture will automatically be run in x86 mode
  • You can force apps in Rosetta 2 / x86 mode by right-clicking app, click Get Info, check "Open using Rosetta"
  • You can force command-line apps by prefixing with arch -x86_64, for example arch -x86_64 go
  • Running a shell in this mode means you don't have to prefix commands: arch -x86_64 zsh then go or whatever
  • Don't just immediately install Homebrew as usual. It should most likely be installed in x86 mode.

Homebrew

Not all toolchains and libraries properly support M1 arm64 chips just yet. Although