Skip to content

Instantly share code, notes, and snippets.

View alextsil's full-sized avatar

Alex Tsilingiris alextsil

View GitHub Profile
@asizikov
asizikov / .wslconfig
Created February 3, 2021 09:58
Configure global WSL options.
#C:\Users\<yourUserName>\.wslconfig
# https://blog.cloud-eng.nl/2021/02/03/wsl2-limits-vmmem/
[wsl2]
memory=6GB # How much memory to assign to the WSL 2 VM.
processors=4 # How many processors to assign to the WSL 2 VM.
swap=1GB # How much swap space to add to the WSL 2 VM, 0 for no swap file.
localhostForwarding=true # ports bound to wildcard or localhost in the WSL 2 VM should be connectable from the host via localhost:port.
@johnmastro
johnmastro / filter-by-val.clj
Last active May 14, 2019 08:35
Filter Clojure maps by value
(defn filter-by-val-1
[pred m]
(into {} (filter (fn [[k v]] (pred v))
m)))
;; This one is a little faster
(defn filter-by-val-2
[pred m]
(persistent!
(reduce-kv (fn [acc k v]
@scaryguy
scaryguy / change_primary_key.md
Last active April 8, 2024 14:23
How to change PRIMARY KEY of an existing PostgreSQL table?
-- Firstly, remove PRIMARY KEY attribute of former PRIMARY KEY
ALTER TABLE <table_name> DROP CONSTRAINT <table_name>_pkey;
-- Then change column name of  your PRIMARY KEY and PRIMARY KEY candidates properly.
ALTER TABLE <table_name> RENAME COLUMN <primary_key_candidate> TO id;
@jelies
jelies / AutowiringSpringBeanJobFactory.java
Last active January 24, 2024 10:43
Quartz (2.1.6) java config with spring (3.2.1). Using a SpringBeanJobFactory to automatically autowire quartz classes.
package com.jelies.spring3tomcat7.config.quartz;
import org.quartz.spi.TriggerFiredBundle;
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.scheduling.quartz.SpringBeanJobFactory;
/**
* This JobFactory autowires automatically the created quartz bean with spring @Autowired dependencies.