Skip to content

Instantly share code, notes, and snippets.

View igolka97's full-sized avatar

Igor Mayorov igolka97

View GitHub Profile
@igolka97
igolka97 / gist:3441261e0d3442c8dc4df2132b1acb36
Created March 17, 2025 22:49
AWS eu-central-1 ip ranges (2025-03-17-18-23-22)
3.2.53.0/24
3.4.12.33/32
3.4.12.34/32
3.4.12.51/32
3.4.12.52/32
3.4.15.80/29
3.4.15.160/29
3.5.134.0/23
3.5.136.0/22
3.33.35.0/24
@igolka97
igolka97 / assertFulfilled.ts
Created August 4, 2024 17:21
Fulfilled promise TypeScript assertion
export function assertFulfilled<T>(
item: PromiseSettledResult<T>,
): item is PromiseFulfilledResult<T> {
return item.status === 'fulfilled';
}
@igolka97
igolka97 / startTick.ts
Created August 4, 2024 16:39
Run promise ticking like setInterval but async
async function startTick (fn: () => Promise<any>, timeoutMs: number = 5000) {
fn().then(() => {
setTimeout(() => {
startTick(fn, timeoutMs)
}, timeoutMs)
})
}
@igolka97
igolka97 / tryUntilSuccess.ts
Created August 4, 2024 16:36
Retry Promise with interval untill resolve
async function tryUntilSuccess (fn: () => Promise<any>, timeoutMs: number = 1000) {
return new Promise((resolve) => {
setTimeout(() => {
fn().catch(() => tryUntilSuccess(fn, timeoutMs)).then(resolve)
}, timeoutMs)
})
}
@igolka97
igolka97 / hosts.yml
Last active June 12, 2024 01:36
Easiest way to use a bastion/jump host in Ansible
all:
vars:
ansible_ssh_common_args: '-J [email protected]'
nodes:
hosts:
node-1:
ansible_host: 192.168.0.10
@igolka97
igolka97 / style.css
Created December 9, 2023 10:46
Disable font smoothing
* {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-smooth: never;
}
@igolka97
igolka97 / mysql-docker.sh
Created September 1, 2020 19:15 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
module.exports = {
http: function(cont, options, next) {
if (cont.$root.$get('nanobar.value') > 1) {
return false;
}
cont.$root.$get('nanobar').go(20)