Skip to content

Instantly share code, notes, and snippets.

View marcj's full-sized avatar
🖌️
Data

Marc J. Schmidt marcj

🖌️
Data
View GitHub Profile
@marcj
marcj / crud.ts
Created July 15, 2021 18:53
Deepkit REST crud automatic controller
#!/usr/bin/env ts-node-script
import 'reflect-metadata';
import { Application } from '@deepkit/framework';
import { http } from '@deepkit/http';
import { ClassSchema, entity, getClassSchema, t } from '@deepkit/type';
import { Database } from '@deepkit/orm';
import { MongoDatabaseAdapter } from '@deepkit/mongo';
import { ClassType, getObjectKeysSize } from '@deepkit/core';
import { AppModule } from '@deepkit/app';
@marcj
marcj / app.ts
Created June 24, 2021 16:20
deepkit: simple database example
#!/usr/bin/env ts-node-script
import 'reflect-metadata';
import { Application, KernelModule } from '@deepkit/framework';
import { http } from '@deepkit/http';
import { entity, t } from '@deepkit/type';
import { Database } from '@deepkit/orm';
import { SQLiteDatabaseAdapter } from '@deepkit/sqlite';
@entity.name('user')
class User {
@marcj
marcj / render-angular-puppeteer.ts
Last active October 2, 2020 14:41
Render Angular as PDF in Puppeteer
//this is more or less pseudocode, not tested, just to demonstrate how it could look like conceptually.
import {AppServerModule} from './src/main.server';
import {ngExpressEngine} from '@nguniversal/express-engine';
const puppeteer = require('puppeteer');
const {join} = require('path');
const {readFileSync} = require('fs');
async function main() {
const renderer = ngExpressEngine({
@marcj
marcj / gist:ab66f9e2cef2e6d5925e12b8885ab549
Last active November 17, 2019 20:22
Clean macOS for VMs
sudo mount -uw /
rm -rf /System/Library/Extensions/AMDRadeon*
rm -rf /System/Library/Extensions/GeForce*
rm -rf /System/Library/Desktop\ Pictures/*
find /System/Library/Templates/Data/System/Library/Speech -name PCMWave -exec rm -rf {} \;
rm -rf /System/Library/Screen\ Savers/*.saver
rm -rf /private/var/db/dyld
```
screen ~/Library/Containers/com.docker.docker/Data/vms/0/tty
```
@marcj
marcj / docker-run.ts
Last active December 5, 2021 15:18
Dockerode Docker run with STDIN in Node.Js
import * as Dockerode from "dockerode";
import * as stream from "stream";
import {ContainerCreateOptions, HostConfig} from "dockerode";
export async function dockerRunWithStdIn(
docker: Dockerode,
stdin: NodeJS.ReadableStream | Buffer,
options: {name: string} & ContainerCreateOptions
): Promise<Buffer> {
return await new Promise<Buffer>(async (resolve, reject) => {
@marcj
marcj / Bla2.ts
Last active February 17, 2019 17:21
Typescript creating a new deep subtype based on runtime arguments.
interface Writer {
id: number;
username: string;
notIncludedAsWell: string;
}
interface Post {
id: number;
content: string;
notIncluded: string;
@marcj
marcj / gist:5e74e4a20205509fe9d7bdbe2d961699
Last active February 1, 2017 00:26
Install AETROS on Windows 10
sudo apt-get install libblas3 libblas-dev
sudo apt-get install liblapack3gf liblapack-dev
sudo apt-get install gfortran
sudo apt-get install libhdf5-dev
sudo chmod -R o+w /usr/local/lib/python2.7/dist-packages
sudo chmod -R o+w /usr/local/bin
pip install numpy
import time
import math
import aetros.backend
job = aetros.backend.start_job('marcj/example-1', '----')
logging_channel = job.create_channel('logging_channel', type=aetros.backend.JobChannel.TEXT)
traces = [
{
From previous released tag to latest tag:
PREVIOUS=`git describe --abbrev=0 --tags $(git rev-list --tags --skip=1 --max-count=1)`
CURREN_TAG=`git describe --abbrev=0 --tags`
git log --format="%h - %s <%an>" "$PREVIOUS..$CURREN_TAG"
Format:
git log --format="%h - %s <%an>" "1.2.0..master"