Skip to content

Instantly share code, notes, and snippets.

View ko1ebayev's full-sized avatar
👾
👾👾👾👾👾👾👾

ko1ebayev

👾
👾👾👾👾👾👾👾
View GitHub Profile
@ko1ebayev
ko1ebayev / install-gui.sh
Created April 10, 2024 21:53
Setup gui on ubuntu remote server
#!/bin/sh
apt update && apt install xfce4 xdm xfce4-xkb-plugin language-pack-ru -y
sed -i 's/allowed_users=console/allowed_users=anybody/' /etc/X11/Xwrapper.config
echo "xfce4-session" | tee ~/.xsession
systemctl enable xdm.service
@ko1ebayev
ko1ebayev / index.ts
Created March 13, 2024 11:10
Empowered angular form control
type StatusChange = (property: string, previousValue: any, value: any) => void;
interface EmpoweredStatus {
property: string;
value: any;
previousValue: any;
}
class EmpoweredFormControl<T extends AbstractControl> {
private static readonly EMPOWER_KEY = '##empower##';
private statusChangeHandlers: StatuChange[] = [];
@ko1ebayev
ko1ebayev / identity.ts
Created January 13, 2024 18:44
Idea: ts identity npm package
export default class Identity {
static isNumber(v: unknown): v is number {
return typeof v === 'number';
}
static isString(v: unknown): v is string {
return typeof v === 'string' || v instanceof String;
}
static isNil(v: unknown): boolean {
@ko1ebayev
ko1ebayev / fix-systemd-resolved.sh
Last active September 14, 2023 07:35
Systemd-resolved DNS configuration bug workaround
# Known systemd bug https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/1624320
# Bug description:
# systemd-resolved, or more precisely the hook script /lib/systemd/system/systemd-resolved.service.d/resolvconf.conf,
# causes resolvconf to add 127.0.0.53 to the set of nameservers in /etc/resolv.conf alongside the other nameservers.
# That makes no sense because systemd-resolved sets up 127.0.0.53 as a proxy for those other nameservers.
# The effect is similar to bug 1624071 but for applications doing their own DNS lookups.
# It breaks any DNSSEC validation that systemd-resolved tries to do; applications will failover to the other nameservers,
# bypassing validation failures. And it makes failing queries take twice as long.
# /etc/resolv.conf should have only 127.0.0.53 when systemd-resolved is active.
@ko1ebayev
ko1ebayev / trackBy.ts
Created March 25, 2022 10:16
Angular utility "trackBy" function
export function trackBy<T>(propertyPath?: keyof T) {
return function(index: number, item: T) {
return propertyPath ? get(item, propertyPath, index) : index;
};
}
export function trackByIdentity<T>(index: number, item: T): T {
return item;
}