Skip to content

Instantly share code, notes, and snippets.

View dcrystalj's full-sized avatar

Tomaz dcrystalj

View GitHub Profile
@maratori
maratori / golang-mocks.md
Last active September 15, 2024 20:06
Comparison of golang mocking libraries

Comparison of golang mocking libraries

Updated 2024-09-01

[gomock][1] [testify][2] + [mockery][3] [mockio][4] [minimock][5] [moq][6]

Library

GitHub stars [![s1]][1] [![s2]][2] + [![s3]][3] [![s4]][4] [![s5]][5] [![s6]][6]
Latest release date [![d1]][r1] [![d2]][r2] + [![d3]][r3] [![d4]][r4] [![d5]][r5] [![d6]][r6]
Maintained
@JimiSweden
JimiSweden / dwraw.io. configuration example.md
Last active January 22, 2024 02:15
draw.io windows app override default configuration to allow larger images

problem

When trying to insert an image you might get the warning "Image too big" when selecting "Actual size" in the insert dialog

Soulution

is to change the default settings.

note: this is tested on Windows, probably similar in Mac - check out the linke here if you are using Mac https://gist.github.com/cellularmitosis/e5e7d1517939b98418a58cdd8595dd8c

open Draw.io app ()

  • in menu "Extras" , select "Configuration".
@chabala
chabala / using-google-takeout.md
Last active September 19, 2024 18:23
Merge and extract tgz files from Google Takeout

Recently found some clowny gist was the top result for 'google takeout multiple tgz', where it was using two bash scripts to extract all the tgz files and then merge them together. Don't do that. Use brace expansion, cat the TGZs, and extract:

$ cat takeout-20201023T123551Z-{001..011}.tgz | tar xzivf -

You don't even need to use brace expansion. Globbing will order the files numerically:

$ cat takeout-20201023T123551Z-*.tgz | tar xzivf -
@meditto
meditto / server.ts
Created March 2, 2020 19:19
use SSL on Adonis 5 dev server
/*
|--------------------------------------------------------------------------
| AdonisJs Server
|--------------------------------------------------------------------------
|
| The contents in this file is meant to bootstrap the AdonisJs application
| and start the HTTP server to accept incoming connections. You must avoid
| making this file dirty and instead make use of `lifecycle hooks` provided
| by AdonisJs service providers for custom code.
|
@virolea
virolea / upload.js
Last active August 28, 2024 02:16
Tracking file upload progress using axios
upload(files) {
const config = {
onUploadProgress: function(progressEvent) {
var percentCompleted = Math.round((progressEvent.loaded * 100) / progressEvent.total)
console.log(percentCompleted)
}
}
let data = new FormData()
data.append('file', files[0])
@cowboy
cowboy / mock-axios.js
Last active July 26, 2024 16:45
axios mocking via interceptors
import axios from 'axios'
let mockingEnabled = false
const mocks = {}
export function addMock(url, data) {
mocks[url] = data
}
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active September 19, 2024 20:21 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy

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 to 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.

@nikhita
nikhita / update-golang.md
Last active September 19, 2024 07:15
How to update the Go version

How to update the Go version

System: Debian/Ubuntu/Fedora. Might work for others as well.

1. Uninstall the exisiting version

As mentioned here, to update a go version you will first need to uninstall the original version.

To uninstall, delete the /usr/local/go directory by:

@mattiaslundberg
mattiaslundberg / Ansible Let's Encrypt Nginx setup
Last active June 10, 2024 01:44
Let's Encrypt Nginx setup with Ansible
Ansible playbook to setup HTTPS using Let's encrypt on nginx.
The Ansible playbook installs everything needed to serve static files from a nginx server over HTTPS.
The server pass A rating on [SSL Labs](https://www.ssllabs.com/).
To use:
1. Install [Ansible](https://www.ansible.com/)
2. Setup an Ubuntu 16.04 server accessible over ssh
3. Create `/etc/ansible/hosts` according to template below and change example.com to your domain
4. Copy the rest of the files to an empty directory (`playbook.yml` in the root of that folder and the rest in the `templates` subfolder)
@ygotthilf
ygotthilf / jwtRS256.sh
Last active September 12, 2024 00:50
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub
cat jwtRS256.key
cat jwtRS256.key.pub