Skip to content

Instantly share code, notes, and snippets.

View TimVosch's full-sized avatar

Tim van Osch TimVosch

View GitHub Profile
@TimVosch
TimVosch / app.controller.ts
Last active February 22, 2024 05:00
Get request parameters in FileInterceptor
import { Controller, UseInterceptors, Post } from '@nestjs/common';
import { AppService } from './app.service';
import { diskStorage } from 'multer';
import { Request } from 'express';
import { MyNewFileInterceptor } from './file.interceptor';
@Controller()
export class AppController {
constructor(private readonly appService: AppService) {}
@TimVosch
TimVosch / app.ts
Created December 22, 2019 19:13
Service nesting and dependencies
/**
* Load internal services
*/
loadServices(): void {
this.sourceTypeService = new SourceTypeService(this.sourceTypeRepo);
this.deviceTypeService = new DeviceTypeService(this.deviceTypeRepo);
this.locationService = new LocationService(this.locationRepo);
//
this.sourceService = new SourceService(
network:
version: 2
renderer: networkd
ethernets:
enp5s0:
addresses:
- 10.0.0.105/24
gateway4: 10.0.0.1
nameservers:
addresses: [10.0.0.1, 8.8.8.8]
@TimVosch
TimVosch / .tmux.conf
Created February 26, 2019 08:00
tmux conf
# Change prefix
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
74c74
< $value = ( '' == $value ) ? '' : $before . $value . $after;
---
> $value = ( '' == trim( $value ) ) ? '' : $before . $value . $after;
346,347c346,347
< $e['date_utc'] = date_i18n( apply_filters( 'mc_date_format', $date_format, 'template_begin_ts' ), $event->ts_occur_begin );
< $e['date_end_utc'] = date_i18n( apply_filters( 'mc_date_format', $date_format, 'template_end_ts' ), $event->ts_occur_end );
---
> $e['date_utc'] = date( apply_filters( 'mc_date_format', $date_format, 'template_begin_ts' ), $event->ts_occur_begin );
> $e['date_end_utc'] = date( apply_filters( 'mc_date_format', $date_format, 'template_end_ts' ), $event->ts_occur_end );
const EventEmitter = require('events');
const manager = new EventEmitter();
class A {
constructor(event) {
event.on('event1', this.doSomething);
}
doSomething(data) {
@TimVosch
TimVosch / Main.hx
Created January 9, 2018 19:38
Resource explorer and extractor
import hxd.Res;
import hxd.App;
import hxd.res.Sound;
import hxd.fs.FileEntry;
import hxd.fmt.pak.FileSystem in PakSystem;
import sys.io.File;
import sys.FileSystem;
class Main{
import java.io.ByteArrayInputStream;
import java.util.ArrayList;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
namespace ClashRoyaleProxy
{
class UdpProxy
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UCS.Core.Crypto.Blake2b;
namespace sandbox
{
class Program