Skip to content

Instantly share code, notes, and snippets.

View horttanainen's full-sized avatar

Santeri Horttanainen horttanainen

View GitHub Profile
@horttanainen
horttanainen / lubitel-2-finder-focusing-problem-fix.txt
Last active August 24, 2024 07:30
Lubitel-2, Amateur-2, Любитель finder focusing problem fix.
I had problems making my lubitel-2 focus. The viewing lens produced inverted results: when focusing to infinity the brilliant
finder focused to objects very close to the camera and vice versa! If this happens to you then your camera has been assembled
wrong and the brilliant finder lens is upside down! The ground glass circle should be in the bottom of the brilliant finder,
not on the top. Just remove the finder casing by renmoving the three screws holding it in place and rotate the finder glass.
Info about the camera:
http://camera-wiki.org/wiki/Lubitel_2
https://sovietcameras.org/lubitel-2/
CLA repair guide:
@horttanainen
horttanainen / migrate-contentful-entry.ts
Last active August 3, 2023 11:34
Migrate Contentful entry and it's child entries from environment to another
import { createClient } from 'contentful-management'
import contentfulExport, { Options } from 'contentful-export'
//@ts-ignore
import contentfulImport from 'contentful-import'
// This code was based on Hany Darwish's solution: https://github.com/contentful/contentful-cli/issues/614#issuecomment-955794191
// MODIFY THESE VALUES BEFORE RUNNING
//
// Run like this ts-node --project migrate-entry-tsconfig.json migrate-contentful-entry.ts
@horttanainen
horttanainen / cert-to-pem.sh
Last active August 9, 2019 11:07
Certificate to PEM
#!/usr/bin/env bash
JS='
function certToPEM(cert) {
if (cert.indexOf("BEGIN CERTIFICATE") === -1 && cert.indexOf("END CERTIFICATE") === -1) {
return `-----BEGIN CERTIFICATE-----\n${cert.match(/.{1,64}/g).join("\n")}\n-----END CERTIFICATE-----\n`;
} else {
return cert;
}
}
@horttanainen
horttanainen / js-shell.sh
Created April 14, 2019 11:52
execute javascript in shell
#!/usr/bin/env bash
JS='
var input = "";
if (process.argv[1] === "-p") {
process.stdin.resume();
process.stdin.setEncoding("utf8");
process.stdin.on("data", function(buf) {
input += buf;
@horttanainen
horttanainen / pretty-print-json-extended.sh
Last active April 14, 2019 12:20
Prettify and transform json from command line
#!/usr/bin/env bash
JS='
var toEval = process.argv[1];
process.stdin.resume();
process.stdin.setEncoding("utf8");
var json = "";
process.stdin.on("data", function(buf) {
json += buf;
@horttanainen
horttanainen / serve-utf8.sh
Last active March 8, 2019 10:02
Script to serve piped text indefinitely
#!/usr/bin/env bash
node -e 'var http = require("http"); var fs = require("fs"); process.stdin.resume(); process.stdin.setEncoding("utf8"); var data = ""; process.stdin.on("data", function(buf) { data += buf; }); process.stdin.on("end", function() { http.createServer(function (request, response) { response.writeHead(200); response.write(data); response.end(); }).listen(8989); });'
@horttanainen
horttanainen / pretty-print-json.sh
Last active March 7, 2019 13:03
Pretty print JSON without jq using node
#!/usr/bin/env bash
node -e 'var fs = require("fs"); process.stdin.resume(); process.stdin.setEncoding("utf8"); var data = ""; process.stdin.on("data", function(buf) { data += buf; }); process.stdin.on("end", function() { console.log(JSON.stringify(JSON.parse(data), null, 2)); });'
@horttanainen
horttanainen / time-screen.sh
Created February 27, 2019 15:18
Create a datadog screenboard from a timeboard
#!/usr/bin/env bash
#params
#dd_api_key=
#dd_app_key=
#dash_id=
curl -sX GET "https://app.datadoghq.com/api/v1/dash/${dash_id}?api_key=${dd_api_key}&application_key=${dd_app_key}" \
| jq '{
board_title: .dash.title,
description: .dash.description,
template_variables: .dash.template_variables,

Keybase proof

I hereby claim:

  • I am horttanainen on github.
  • I am horttanainen (https://keybase.io/horttanainen) on keybase.
  • I have a public key whose fingerprint is FB31 D7CE 2A56 6B4E 7222 9F3D D2E0 0B54 5888 2E56

To claim this, I am signing this object: