Skip to content

Instantly share code, notes, and snippets.

@ajkovar
ajkovar / zip-and-encrypt.sh
Created September 18, 2020 15:32
zip and encrypt
zip -r -X file.zip file
gpg -c file.zip
@ajkovar
ajkovar / ruby-2.3-install-issues.md
Last active November 20, 2020 03:17
ruby-2.3.0 install issues
rvm install ruby-2.3.0

this gave this error:

more /Users/alex/.rvm/log/1600191501_ruby-2.3.0/rubygems.install.log
[2020-09-15 12:46:13] /Users/alex/.rvm/rubies/ruby-2.3.0/bin/ruby
current path: /Users/alex/.rvm/src/rubygems-3.0.8
GEM_HOME=/Users/alex/.rvm/gems/ruby-2.7.1
PATH=/usr/local/opt/coreutils/bin:/usr/local/opt/pkg-config/bin:/usr/local/opt/libtool/bin:/usr/local/opt/automake/bin:/usr/local/opt/autoconf/bin:/Users/alex/.cabal/bin:/Users/alex/.ghcup/bin:/Users/alex/.nvm/versions/node/v8.11.3/bin:/Users/alex/.nix-profile/bin:/Users/alex/bin:/Users/alex/.rvm/gems/ruby-2.7.1/bin:/Users/alex/.rvm/gems/ruby-2.7.1@global/bin:/Users/alex/.rvm/rubies/ruby-2.7.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/Library/Apple/usr/bin:/Users/alex/.rvm/bin

GEM_PATH=/Users/alex/.rvm/gems/ruby-2.7.1:/Users/alex/.rvm/gems/ruby-2.7.1@global

# debug jest in chrome
node --inspect-brk node_modules/.bin/jest --runInBand

Currently getting this while intending to use babel plugin for format.js:

Error: Requires Babel "^7.0.0-0", but was loaded with "6.26.3". If you are sure you have a compatible version of @babel/core, it is likely that something in your build process is loading the wrong version. Inspect the stack trace of this error to look for the first entry that doesn't mention "@babel/core" or "babel-core" to see what is calling Babel.
at throwVersionError (/Users/alex/projects/you/YOU-Frontend/node_modules/@babel/helper-plugin-utils/lib/index.js:65:11)
at Object.assertVersion (/Users/alex/projects/you/YOU-Frontend/node_modules/@babel/helper-plugin-utils/lib/index.js:13:11)
at /Users/alex/projects/you/YOU-Frontend/node_modules/babel-plugin-react-intl/src/index.ts:302:7
at /Users/alex/projects/you/YOU-Frontend/node_modules/@babel/helper-plugin-utils/lib/index.js:19:12

Problematic line:

-- get types of an expression
:t (fail)
-- Get info about type classes that this type implements
:i Int
-- Get info about the 'kind' of a type (somoething like the type of the type)
:k Int
-- See contents of a module
@ajkovar
ajkovar / reverse-proxy.js
Last active August 24, 2020 20:31
Reverse proxy server for serving bundled assets
var httpProxy = require('http-proxy'),
fs = require('fs'),
http = require('http'),
url = require('url'),
path = require('path'),
iconv = require('iconv-lite');
var proxy = httpProxy.createProxyServer({});
proxy.on('error', function(e) {
@ajkovar
ajkovar / nix.md
Last active August 28, 2020 20:49

See what installable packages are currently available in the channel:

$ nix-env -qa

(-q is for query and -a for available) What is the channel?

It is also possible to see the status of available packages, i.e., whether they are installed into the user environment and/or present in the system:

nix-env -qas

Ran into this while running nix-build (for buildling a haskell project:

"checking whether the C compiler works... no osx"

This fixed it:

xcode-select --install

This didn't seem to fix the problem. Also ran this:

@ajkovar
ajkovar / setting-up-wepack.md
Last active July 7, 2020 01:52
Steps for getting webpack/typescript/HtmlWebPackPlugin working to my liking

I spent some time today setting up a project using React, Typescript, and Webpack. There are various guides out there but none were quite to my liking. It took a little while to get everything working right so I decided to document my journey. Mostly I just did this for my own purposes but maybe it will be helpful to someone. I'll be breaking it down step by step with every error along the way documented. If you are looking for a quick get up and running guide and you don't care about any of the details, this is probably not the place for you. If you are here to resolve some issue you have had or maybe want some insight into how things work and why they need to be configured the way they are, this post might help you.

Why did I do this? For one thing, HtmlWebPackPlugin was not mentioned in many posts. I find that this plugin helps to cleanup the syntax of wiring everything together. Typescript's own website [rec