Skip to content

Instantly share code, notes, and snippets.

View thejhh's full-sized avatar
💭
Excellence isn't believing you're best; It's about always striving to get better

Jaakko Heusala thejhh

💭
Excellence isn't believing you're best; It's about always striving to get better
View GitHub Profile
@thejhh
thejhh / AuthController.md
Last active March 7, 2021 17:50
Simple stateless JWT Authentication REST service, written in TypeScript, using experimental request mapping annotations

Flow

@thejhh
thejhh / UserController.ts
Created February 8, 2021 19:26
POC: Spring style annotations in TypeScript
// Copyright (c) 2020 Sendanor. All rights reserved.
import Request from "../../core/Request";
import UserService, {UserModel} from "./UserService";
export interface ListDTO<T> {
pageNumber : number;
pageSize : number;
content : Array<T>;
// Copyright (c) 2020 Sendanor. All rights reserved.
export interface JsonSerializable {
toJSON () : JsonAny;
}
export type JsonAny = string | number | boolean | null | JsonArray | JsonObject | JsonSerializable;
export type JsonObjectOf<T extends JsonAny> = { [name: string]: T | undefined };
export type JsonObject = { [name: string]: JsonAny | undefined };
export type JsonArrayOf<T extends JsonAny> = Array<T>;
@thejhh
thejhh / InstallWp.ts
Last active November 23, 2024 12:08
Example how to write Ansible playbooks in TypeScript
// Copyright (c) 2020 Sendanor. All rights reserved.
import Ansible, {AnsibleTask as Task} from "../utils/Ansible";
import Build from "../utils/Build";
import Tag from "../types/Tag";
import Play from "../types/Play";
import {FileTaskState} from "../types/FileTask";
enum InstallWpVariable {
@thejhh
thejhh / Observer.ts
Last active September 19, 2020 09:55
Observer.ts
// Copyright 2020 Jaakko Heusala <jheusala@iki.fi>
// Licence: MIT
import {filter, forEach, has} from "../../modules/lodash";
export interface ObserverCallback<EventName extends keyof any> {
(event: EventName) : void;
}
export interface ObserverDestructor {
@thejhh
thejhh / compile.sh
Last active July 21, 2020 21:09
Bookmarklet to export order from holvi.com
#!/bin/bash
uglifyjs order-export.js --compress --mangle > min.js
sed -e 's/^function e(/function(/' -e 's/ /%20/g' min.js > min2.js
echo "javascript:($(cat min2.js))()"

Extra Short Getting Started for Ansible

This page has multiple mini guides about using Ansible.

Start using Ansible

Eg. How to automate rsync package installation on multiple Debian/Ubuntu based hosts.

1. Install Ansible

@thejhh
thejhh / 02-reconfigure-tzdata.yml
Last active June 19, 2020 17:09
09-configure-timezone.yml
- name: Reconfigure tzdata
include_tasks: 20-reconfigure-tzdata.yml
$ test "$memmb" -gt 4000
-bash: test: : integer expression expected
$ test $memmb -gt 4000
-bash: test: -gt: unary operator expected
$ [ $memmb -gt 4000 ]
-bash: [: -gt: unary operator expected
$ [ "$memmb" -gt 4000 ]
@thejhh
thejhh / bootstrap-container-ssh.yml
Last active May 28, 2020 19:22
Example how to bootstrap install SSH pubkeys to remote lxc containers
---
- hosts: containers
remote_user: root
connection: local
tasks:
- name: Test for SSH host key verification
local_action: command is-ssh-host-verified {{ inventory_hostname }}
changed_when: false
failed_when: false
register: ssh_host_verified