Skip to content

Instantly share code, notes, and snippets.

View markusl's full-sized avatar

Markus Lindqvist markusl

  • Supercell
  • Finland
View GitHub Profile
@markusl
markusl / voikko_baseform.py
Created October 6, 2023 05:22
Read all files from the input folder and convert all words in them to baseform words and write files to the output folder.
import libvoikko
import json
import os
# Read all files from the input folder and convert all words in them to baseform words and write files to the output folder.
# brew install --cask voikkospellservice
# brew install libvoikko
# pip3 install libvoikko
@markusl
markusl / gzip-json-files-in-aws-s3.ts
Last active May 30, 2022 12:07
A AWS Lambda function to in-plae Gzip compress all JSON files in AWS S3 bucket
/**
This is an AWS Lambda function which, when run, Gzip compressess all JSON files in AWS S3 bucket.
Define BUCKET_NAME environment variable to specify the bucket.
A new file is written based on the object name. For example "foo.json" is compressed to "foo.json.gz" and the old object is removed.
*/
import { S3, ListObjectsV2Output, ListObjectsV2CommandOutput } from '@aws-sdk/client-s3';
import * as zlib from 'zlib';
@markusl
markusl / installMobileProvisionFile.sh
Created January 11, 2022 17:58 — forked from benvium/installMobileProvisionFile.sh
This script installs a .mobileprovision file via bash (no GUI session needed)
#!/bin/sh
# 2012 - Ben Clayton (benvium). Calvium Ltd
# Found at https://gist.github.com/2568707
#
# This script installs a .mobileprovision file without using Xcode. Unlike Xcode, it'll
# work over SSH.
#
# Requires Mac OS X (I'm using 10.7 and Xcode 4.3.2)
#
@markusl
markusl / aws-macos-jenkins-worker.ts
Last active December 29, 2021 08:02
How to run AWS macOS EC2 instance and automatically resize disk using AWS CDK
/**
To be used with https://aws.amazon.com/blogs/opensource/integrating-ec2-macos-workers-with-eks-and-jenkins/
*/
import {
aws_ec2 as ec2,
aws_eks as eks,
aws_iam as iam,
Stack,
@markusl
markusl / README.md
Last active March 11, 2021 07:18
AWS ALB Azure AD OIDC Provider

Example AWS CDK code for adding Azure AD OIDC provider in AWS ALB

AWS documentation https://docs.aws.amazon.com/elasticloadbalancing/latest/application/listener-authenticate-users.html

You can configure an Application Load Balancer to securely authenticate users as they access your applications. This enables you to offload the work of authenticating users to your load balancer so that your applications can focus on their business logic.

See also

#!/usr/bin/env node
import 'source-map-support/register';
import * as core from '@aws-cdk/core';
import * as ec2 from '@aws-cdk/aws-ec2';
import * as ecs from '@aws-cdk/aws-ecs';
import * as ecs_patterns from '@aws-cdk/aws-ecs-patterns';
// Example code from: https://docs.aws.amazon.com/cdk/latest/guide/home.html
export class MyEcsConstructStack extends core.Stack {
constructor(scope: core.App, id: string, props?: core.StackProps) {
@markusl
markusl / aws-cdk-s3-example.ts
Created August 7, 2019 10:17
AWS CDK S3 Example
#!/usr/bin/env node
import 'source-map-support/register';
import * as cdk from '@aws-cdk/core';
import * as s3 from '@aws-cdk/aws-s3';
/**
* npm run build
* cdk deploy --profile demo BucketStack
* change code
* cdk diff --profile demo BucketStack

Keybase proof

I hereby claim:

  • I am markusl on github.
  • I am markusl (https://keybase.io/markusl) on keybase.
  • I have a public key ASDgPVGd9rYgJsEPT_ztMJQY5qWIZLyqEp-UKkCqAWsQQgo

To claim this, I am signing this object:

@markusl
markusl / yes.rs
Created June 14, 2017 10:05
'yes' implementation in Rust
use std::io::{stdout, Write};
// Compile: rustc -O -C lto yes.rs
// Use: ./yes | pv > /dev/null
// 97GiB 0:00:57 [3.72GiB/s] [ <=> ]
fn main() {
let buffer = "y\n".repeat(16384).into_bytes();
let stdout = stdout();
let mut stdout = stdout.lock();
@markusl
markusl / site.coffee
Last active August 29, 2015 14:13
Houm.io temperature collection with Enocean STM-330
Bacon = require('baconjs')
serialport = require("serialport")
sleep = require('sleep')
WebSocket = require('ws')
winston = require('winston')
Keen = require('keen.io')
Keen = Keen or
configure: (e) ->
@_cf = e