Skip to content

Instantly share code, notes, and snippets.

View theAkito's full-sized avatar
💭
Never complain, never explain.

Akito theAkito

💭
Never complain, never explain.
View GitHub Profile
@shannah
shannah / batsh.php
Created February 4, 2021 18:50
A simple PHP script for compiling Batsh scripts to bash and windows bat scripts. This is a thin wrapper around the hosted batsh compiler at https://batsh.org
<?php
/**
Copyright (c) 2021 Steve Hannah
Permission is hereby granted, free of charge,
to any person obtaining a copy of this software and
associated documentation files (the "Software"), to
deal in the Software without restriction, including
without limitation the rights to use, copy, modify,
merge, publish, distribute, sublicense, and/or sell
@ygoe
ygoe / ManagedUnixCrypt.cs
Created August 30, 2020 17:48
A managed implementation of the Unix C library crypt function. Supports MD5, SHA-256 and SHA-512.
using System;
using System.IO;
using System.Security.Cryptography;
using System.Text;
namespace YourApp.Util
{
/// <summary>
/// A managed implementation of the Unix C library crypt function. It supports the MD5, SHA-256
/// and SHA-512 algorithms.
@deeagle
deeagle / repair-debian-lib-XCRYPT_2.0.sh
Last active April 15, 2023 23:27
Simple fix for a debian linux upgrade to bullseye. Some packages will show an error message like `/usr/bin/perl: /lib64/libcrypt.so.1: version `XCRYPT_2.0' not found (required by /usr/bin/perl` and you have to link the new spot of the library. Update: I have to run it before installs and upgrades and everything is fine.
#!/bin/bash
# Needed for debian upgrade
# atm from buster to bullseye the linked libs are broken
# see: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=951880
LIB="libcrypt.so.1"
# Checks if the executer has super user permissions.
#
@cmod
cmod / hugofastsearch.md
Last active September 10, 2024 11:20 — forked from eddiewebb/readme.md
Fast, instant client side search for Hugo static site generator

Super fast, keyboard-optimized, client side Hugo search

This is a fork of and builds upon the work of Eddie Webb's search and Matthew Daly's search explorations.

It's built for the Hugo static site generator, but could be adopted to function with any json index compatible with Fuse fuzzy search library.

To see it in action, go to craigmod.com and press CMD-/ and start typing.

Fast Search

@adaRn
adaRn / etc logrotate.d openvpn
Created August 15, 2019 14:33
This is logrotate configuration for OpenVPN. It prevents you from huge OpenVPN log files. `copytruncate` option here is very important - OpenVPN doesn't want to close the logfile it's writing to, so this file is automatically truncated after copying its contents.
/var/log/openvpn.log {
daily
rotate 12
compress
copytruncate
delaycompress
missingok
notifempty
}
@mreichelt
mreichelt / KotlinMapIntersection.kt
Created August 13, 2018 11:25
Kotlin: Intersect maps with different value types on their keys
/**
* Intersect two maps with same keys, but different data types. Preserves the order of the first map.
* Returns a list of the combined type provided by the transformation.
*/
inline fun <Key, Value1, Value2, T> Map<Key, Value1>.intersectWith(
other: Map<Key, Value2>,
transformationFunction: (Value1, Value2) -> T): List<T> {
return flatMap { oldEntry ->
other.filterKeys { it == oldEntry.key }
.map { transformationFunction(oldEntry.value, it.value) }
@aanandshekharroy
aanandshekharroy / ParameterizedUnitTest.kt
Created February 10, 2018 11:04
Used JUnitParams to create parametrized unit test in Kotlin
import junitparams.JUnitParamsRunner
import junitparams.Parameters
import org.junit.Test;
import org.junit.Assert.*;
import org.junit.Before
import org.junit.runner.RunWith
import org.junit.runners.Parameterized
import java.util.*
@Arham4
Arham4 / data.yaml
Last active September 20, 2023 01:26
Easy Jackson YAML Parsing with Kotlin
username: "Test"
password: "123456"
@josdejong
josdejong / merge.kt
Last active October 24, 2023 09:30
Merge two data classes in Kotlin
import kotlin.reflect.full.declaredMemberProperties
import kotlin.reflect.full.primaryConstructor
/**
* Merge two data classes
*
* The resulting data class will contain:
* - all fields of `other` which are non null
* - the fields of `this` for the fields which are null in `other`
*
@matklad
matklad / idea.nix
Last active September 2, 2024 23:03
Using JetBrains JDK with Intellij IDEA on nixos
# Put this file into `~/.config/nixpkgs/overlays/idea.nix`.
# Then, install IDEA with `nix-env -iA nixos.idea-community`.
self: super:
{
jbsdk = super.callPackage ~/config/nix/jbsdk.nix {}; # you might need to override this path.
idea-community = let
version = "2017.2.3";