Skip to content

Instantly share code, notes, and snippets.

View vikpe's full-sized avatar
🚀

Viktor Persson vikpe

🚀
View GitHub Profile
@sindresorhus
sindresorhus / esm-package.md
Last active July 24, 2024 08:34
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@vladak
vladak / varmilo keyboard.md
Last active June 28, 2024 17:16
Varmilo keyboard details
@andli
andli / provision.ps1
Last active February 5, 2022 11:28
New workstation win10
# Step 0, manually:
# * Install new Edge
# * Install new Terminal from windows store
# "colorScheme": "One Half Dark"
# "fontFace": "Fira Code"
# * Add OneDrive work account
# * Add OneDrive personal account to get keepass database
# Get scoop
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
@vikpe
vikpe / the_zen_of_python.md
Last active February 17, 2020 09:43
The Zen of Python

The Zen of Python

https://www.python.org/dev/peps/pep-0020/

  • Beautiful is better than ugly.
  • Explicit is better than implicit.
  • Simple is better than complex.
  • Complex is better than complicated.
  • Flat is better than nested.
  • Sparse is better than dense.
  • Readability counts.
@naesheim
naesheim / buildWhenAffected.sh
Last active November 28, 2022 20:20
CircleCi - only build features that has changed
##################
### config.yml ###
##################
version: 2
jobs:
build:
docker:
- image: circleci/python:3.6
steps:
@vikpe
vikpe / css_responsive_border.css
Last active May 3, 2021 14:22
CSS responsive border using box-shadow to simulate the same behavior as "border-collapse: collapse"
.responsive-border {
box-shadow: 1px 0 0 0 black,
0 1px 0 0 black,
1px 1px 0 0 black,
1px 0 0 0 black inset,
0 1px 0 0 black inset;
}
@wojteklu
wojteklu / clean_code.md
Last active July 24, 2024 12:04
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@vikpe
vikpe / ssl_upgrades_rubygems_windows_workaround.md
Last active January 6, 2018 20:34
Rubygems SSL certificate error fix for Windows

Fix for rubygems SSL certificate error on Windows

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
  1. Download R1 GlobalSign Root Certificate: https://secure.globalsign.net/cacert/Root-R1.crt
  2. Save it somewhere local, so you can easily access it from a command prompt.
  3. Convert to a PEM file. openssl x509 -in Root-R1.crt -out GlobalSignRootR1.pem -outform PEM -inform DEF
  4. Copy the new GlobalSignRootR1.pem file that it creates into: D:\Ruby23-x64\lib\ruby\2.3.0\rubygems\ssl_certs\ <-- this path will obviously be different depending on where you've got Ruby installed!

Offline Python Package Install Notes

Two common cases which make the install of Python packages harder due to networking issues are: a) Install behind a Proxy b) Install without access to the internet

(a) Install behind a Proxy

In the case where the target machine connects to the internet over a network proxy, export the following environment vars, as appropriate - http_proxy and https_proxy. Eg:

@denji
denji / golang-tls.md
Last active July 1, 2024 05:41 — forked from spikebike/client.go
Simple Golang HTTPS/TLS Examples

Moved to git repository: https://github.com/denji/golang-tls

Generate private key (.key)
# Key considerations for algorithm "RSA" ≥ 2048-bit
openssl genrsa -out server.key 2048

# Key considerations for algorithm "ECDSA" ≥ secp384r1
# List ECDSA the supported curves (openssl ecparam -list_curves)