Skip to content

Instantly share code, notes, and snippets.

View tatupesonen's full-sized avatar

Tatu Pesonen tatupesonen

View GitHub Profile
@tatupesonen
tatupesonen / update-secret.sh
Last active April 11, 2023 19:39
Quick bash function to update a Kubernetes secret
update_secret() {
# Uses yq and kubectl:
# https://mikefarah.gitbook.io/yq/
local SECRET=$(kubectl get secret $1 -o yaml) || echo "error"
local YAML=$(echo $SECRET | yq '.data[] |= @base64d')
local TMP=$(mktemp /tmp/secret.XXXXXXXXXXX.yaml)
echo $YAML > $TMP
$EDITOR $TMP
cat $TMP | yq '.data[] |= @base64' | kubectl apply -f -
rm $TMP
@tatupesonen
tatupesonen / translate.js
Created November 18, 2022 14:52
Translate
const path = require('path');
const YAML = require('yaml')
fs = require('fs');
const exec = require('child_process').execSync;
const filenames = [];
function fromDir(startPath, filter) {
if (!fs.existsSync(startPath)) {
return;
-- Install packer
local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim'
local is_bootstrap = false
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
is_bootstrap = true
vim.fn.execute('!git clone https://github.com/wbthomason/packer.nvim ' .. install_path)
vim.cmd [[packadd packer.nvim]]
end
-- stylua: ignore start
@tatupesonen
tatupesonen / index.html
Created June 26, 2022 21:18
odin landing page done quick
<!DOCTYPE html>
<html>
<head>
<title>Thing</title>
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@100;200;300;400;500;600;700;800;900&display=swap"
rel="stylesheet"
/>
import { differenceInMilliseconds, differenceInSeconds } from "date-fns";
export class Cache {
constructor({ minInterval = 1000 }) {
this.minInterval = minInterval;
this._map = new Map();
}
// Key could be an item here
check = (key) => {
@tatupesonen
tatupesonen / merge.js
Last active January 11, 2022 09:02
Object specific merge
const util = require("util");
const { performance } = require("perf_hooks");
// Input data is like this
const exampleInput = [
{ 9668: { "Fa0/11": { in_traffic: "1000" } } },
{ 9668: { "Fa0/11": { out_traffic: "900" } } },
{ 9628: { "Fa0/16": { in_traffic: "800" } } },
];
@tatupesonen
tatupesonen / start-tekken.bat
Last active May 22, 2020 17:01
Remove Gallery and Story folders and start TEKKEN 7
::USAGE
::Make a start-tekken.bat file and paste the contents of this file inside of it.
::Replace the gamePath folder value with your TEKKEN 7 folder location.
::Example:
::set gamePath=C:\Program Files (x86)\Steam\steamapps\common\TEKKEN 7 for the default TEKKEN 7 install.
@echo off
set gamePath=C:\Program Files (x86)\Steam\steamapps\common\TEKKEN 7
IF EXIST "%gamePath%\TekkenGame\Content\Movies\Gallery" (
echo Removing Gallery folder...
@tatupesonen
tatupesonen / script.js
Created September 1, 2018 20:54
What's the difference?
var Person = function (name, yearOfBirth, job) {
this.name = name;
this.yearOfBirth = yearOfBirth;
this.job = job;
//This
this.calculateAge = function () {
console.log(2018 - this.yearOfBirth);
}
}
using System;
using System.IO;
using System.Collections.Generic;
using System.Diagnostics;
namespace SongEncoder
{
class Program
{
static void Main(string[] args)