Skip to content

Instantly share code, notes, and snippets.

View karolzlot's full-sized avatar
🏠
Working from home

Karol Zlot karolzlot

🏠
Working from home
View GitHub Profile
@MichaelPolla
MichaelPolla / github-resize-pictures.md
Last active July 5, 2024 21:21
Markdown - Resize pictures in GitHub, including in comments comment

Markdown - Resize pictures in GitHub

I found that the "best" way is to use HTML, as it works both in Readme/.md files and also in comments (within Issues, Gist...)

E.g. when adding/editing a comment (within Issues, Gist...) :

  • Upload the picture by drag-and-drop in the text field
  • replace ![image](https://your-image-url.type) with <img src="https://your-image-url.type" width="100" height="100">

As mentioned by @cbestow (thanks!), it's not mandatory to set both width and height. If only one is set, the other will be adjusted accordingly to preserve the aspect ratio of the image.

@thehesiod
thehesiod / gather_cancel_children_on_exception.py
Last active September 27, 2022 08:55
asyncio cancel all tasks on first task's exception
import asyncio
import logging
from typing import List
def _ignore_task_exception(task: asyncio.Future, logger: logging.Logger):
# noinspection PyBroadException
try:
task.result()
except BaseException:

Exporting your 2FA tokens from Authy to transfer them into another 2FA application

IMPORTANT - Update regarding deprecation of Authy desktop apps

Past August 2024, Authy stopped supported the desktop version of their apps:
See Authy is shutting down its desktop app | The 2FA app Authy will only be available on Android and iOS starting in August for details.

And indeed, after a while, Authy changed something in their backend which now prevents the old desktop app from logging in. If you are already logged in, then you are in luck, and you can follow the instructions below to export your tokens.

If you are not logged in anymore, but can find a backup of the necessary files, then restore those files, and re-install Authy 2.2.3 following the instructions below, and it should work as expected.

@001101
001101 / accounting.sql
Created February 18, 2017 09:08 — forked from NYKevin/accounting.sql
Basic double-entry bookkeeping system, for PostgreSQL.
CREATE TABLE accounts(
id serial PRIMARY KEY,
name VARCHAR(256) NOT NULL
);
CREATE TABLE entries(
id serial PRIMARY KEY,
description VARCHAR(1024) NOT NULL,
amount NUMERIC(20, 2) NOT NULL CHECK (amount > 0.0),
-- Every entry is a credit to one account...
@qwert2001qwert
qwert2001qwert / currency.sql
Last active September 1, 2021 16:16 — forked from allanlaal/currency.sql
SQL table of World currencies and symbols (коды валют мира и их символы)
CREATE TABLE IF NOT EXISTS `currency` (
`iso` char(3) CHARACTER SET utf8 NOT NULL DEFAULT '',
`name` varchar(200) COLLATE utf8_unicode_ci NOT NULL,
`symbol` varchar(3) COLLATE utf8_unicode_ci DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
INSERT INTO `currency` (`iso`, `name`, `symbol`) VALUES
('ADP', 'Andorran Peseta', 'ADP'),
@doobeh
doobeh / home.html
Created January 19, 2016 14:04
More complete example of FieldList with FormField
<form method="post" action="">
{{ form.name}}
{{ form.hidden_tag() }}
<br/>
{% for entry in form.hours %}
{{ loop.index0|dow }}
{{ entry() }}
{% endfor %}
<input type="submit"/>
</form>
@vichango
vichango / countries.sql
Last active September 1, 2021 16:08 — forked from allanlaal/countries.sql
Uses InnoDB and UTF-8. The ISO 3166-1 alpha-2 code is used as the primary key.
--
-- Table structure for table `country`
--
CREATE TABLE IF NOT EXISTS `country` (
`iso` char(2) COLLATE utf8_unicode_ci NOT NULL,
`name` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
`nicename` varchar(80) COLLATE utf8_unicode_ci NOT NULL,
`iso3` char(3) COLLATE utf8_unicode_ci DEFAULT NULL,
`numcode` smallint(6) DEFAULT NULL,
@0xbadfca11
0xbadfca11 / 00_README.md
Last active January 3, 2025 12:54
Windows ReFS versions
@tresni
tresni / gist:83b9181588c7393f6853
Last active September 7, 2024 02:35
Authy to 1Password

Moving Authy to 1Password

1Password 5.3 for OSX, 5.2 for iOS, and 4.1.0.538 for Windows support OTP. I've been using Authy for a while now, but the fact is, I haven't really been using 2FA for some time. As mentioned by 1Password in a recent blog post, having the OTP generator and password on the same device is very much not 2FA. It's just an expiring OTP, which can help, but let's not kid ourselves too much.

With that out of the way. One of the things that was interesting to me was moving my OTP out of Authy and into 1Password. I like the control I get with 1Password, but I didn't want to have to reset all my OTP right away, that would suck. So, I got to dissecting the Authy Chrome App to see what I could do.

Run the Authy Chrome app and make sure it's unlocked.

Now, enable Developer mode in Chrome. We'll need this to inspect the background application that stores al

@nuada
nuada / calculate-kinship.sh
Created March 6, 2015 12:37
Calculate kinship coefficient for set of samples in VCF
#!/bin/bash
bcftools norm -Ou -m -any $1 | # Split multi-allelic alleles
bcftools norm -Ou -f /resources/hg19/ucsc.hg19.fasta | # Normalize
bcftools annotate -Ob -x ID -I +'%CHROM:%POS:%REF:%ALT' | # Replace IDs with unique ID
plink --bcf /dev/stdin --keep-allele-order --double-id --allow-extra-chr 0 --make-bed --out variants
king -b variants.bed --kinship --prefix kinship
king -b variants.bed --individual