Skip to content

Instantly share code, notes, and snippets.

View isc30's full-sized avatar
💭
:trollface:

Ivan Sanz Carasa isc30

💭
:trollface:
View GitHub Profile
@isc30
isc30 / steps.md
Last active November 9, 2024 21:49
Proxmox v7.4/v8 - Ryzen 7 7735HS - AMD Radeon 680M GPU passthrough
@isc30
isc30 / DynamicComponent.ts
Last active July 29, 2021 10:34
Angular Dynamic Component
import { Component, ComponentFactoryResolver, Input, OnInit, ViewContainerRef, Type, AfterViewInit, ComponentRef, ChangeDetectorRef, ViewChild, TemplateRef, Injector } from '@angular/core';
import { checkRequiredInputs, Required } from '../../decorators/required.decorator';
export interface DynamicComponentModel<T = unknown>
{
type: Type<T>;
inputs?: Partial<T>;
}
@isc30
isc30 / Dockerfile
Created March 30, 2021 14:51
docker azure agent
FROM czon/azdo-agent:ubuntu-20.04-2.182.1
USER root
# Install the latest Docker CE binaries and add user `jenkins` to the docker group
RUN apt-get update && \
apt-get -y --no-install-recommends install apt-transport-https \
ca-certificates \
curl \
gnupg2 \
@isc30
isc30 / docker-compose.yml
Last active November 3, 2020 15:36
Jenkins Docker-Compose
version: '3.4'
services:
jenkins:
restart: "unless-stopped"
image: 4oh4/jenkins-docker
volumes:
- "jenkins_data:/var/jenkins_home"
- "/var/run/docker.sock:/var/run/docker.sock"
labels:
@isc30
isc30 / SelectParallel.cs
Last active September 24, 2020 23:42
SelectParallel
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
namespace Test
{
class Program
{
#include <iostream>
#include <vector>
#include <string>
using namespace std;
class SparseVector
{
private:
std::vector<bool> orderVec;
std::vector<int> valueVec;
template<typename TBase, typename... Types>
constexpr auto polymorphic_get(std::variant<Types...>& v)
-> std::enable_if_t<(std::is_base_of_v<TBase, Types> && ...), TBase&>
{
return *std::visit([](auto& x){ return dynamic_cast<TBase*>(&x); }, v);
}
@isc30
isc30 / download_binary.js
Last active June 12, 2023 04:26
downloading binary data as a file
function download_binary(binaryData, fileName, mime)
{
file = new Blob([binaryData], { type: mime });
downloadUrl = URL.createObjectURL(file);
// download the Blob
anchor = document.createElement('a');
anchor.download = fileName;
anchor.href = downloadUrl;
anchor.dataset.downloadurl = mime + ":" + fileName + ":" + downloadUrl;
@isc30
isc30 / callable.hpp
Last active November 30, 2022 12:13
template-based wrapper for any callable with signature + metadata traits
#pragma once
#include <type_traits>
#include <functional>
template<typename TCallable, typename TSignature>
constexpr bool is_callable_as_v = std::is_constructible<std::function<TSignature>, TCallable>::value;
template<
typename TCallable,
@isc30
isc30 / triangle.cpp
Last active January 13, 2023 23:03 — forked from vittorioromeo/hello_triangle.cpp
SDL2 + WebGL 2.0 = Triangle
#include <iostream>
#include <exception>
#include <functional>
#include <vector>
#ifdef __EMSCRIPTEN__
#include <emscripten.h>
#endif
#ifndef __EMSCRIPTEN__