Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🖕Fucking Kubernetes

Yanick.xia yanickxia

💭
🖕Fucking Kubernetes
View GitHub Profile
@yanickxia
yanickxia / addTypeInformationToObject.go
Created Nov 22, 2020
k8s-addTypeInformationToObject
View addTypeInformationToObject.go
// addTypeInformationToObject adds TypeMeta information to a runtime.Object based upon the loaded scheme.Scheme
// inspired by: https://github.com/kubernetes/cli-runtime/blob/v0.19.2/pkg/printers/typesetter.go#L41
func addTypeInformationToObject(obj runtime.Object) error {
gvks, _, err := scheme.Scheme.ObjectKinds(obj)
if err != nil {
return fmt.Errorf("missing apiVersion or kind and cannot assign it; %w", err)
}
for _, gvk := range gvks {
if len(gvk.Kind) == 0 {
View anync.rs
#![allow(unused)]
use {
futures::{
future::{BoxFuture, FutureExt},
task::{ArcWake, waker_ref},
},
std::{
future::Future,
pin::Pin,
View toggl-tomator.js
// ==UserScript==
// @name add tomator timer for toggle
// @namespace http://tampermonkey.net/
// @version 0.1
// @description try to take over the world!
// @author yanick
// @match toggl.com/*
// @match app.clickup.com/*
// @grant GM_addStyle
// @require http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js
View bfs.java
import java.util.LinkedList;
import java.util.Queue;
import java.util.Stack;
public class TreeSearch {
public static void depthFirstSearchWithStack(int[][] adjMatrix) {
boolean[] visitors = new boolean[adjMatrix.length];
Stack<Integer> stack = new Stack<>();
View docker-compose.yml
web:
image: 'gitlab/gitlab-ce:latest'
restart: always
hostname: 'gitlab.example.com'
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://git.mschina.io'
gitlab_rails['smtp_enable'] = true
gitlab_rails['smtp_address'] = 'smtp.mailgun.org'
gitlab_rails['smtp_port'] = 587
View Final_Method_In_Abstart_Class.java
public abstract class BaseLoaneeRepayment implements Repayment {
@Autowired
protected LoanRepository loanRepository;
@Transactional(propagation = Propagation.REQUIRES_NEW)
public final void repay(RepaymentInfo repaymentInfo) {
Loan loan = loanRepository.lockAndLoad(repaymentInfo.getLoan().id());
}
protected abstract void preCheck(final RepaymentInfo repaymentInfo);