Skip to content

Instantly share code, notes, and snippets.

@m-jovanovic
m-jovanovic / Result.cs
Created September 7, 2023 08:03
Result type
public class Result
{
protected internal Result(bool isSuccess, Error error)
{
if (isSuccess && error != Error.None)
{
throw new InvalidOperationException();
}
if (!isSuccess && error == Error.None)
@andreicristianpetcu
andreicristianpetcu / ansible-summary.md
Created May 30, 2016 19:25
This is an ANSIBLE Cheat Sheet from Jon Warbrick

An Ansible summary

Jon Warbrick, July 2014, V3.2 (for Ansible 1.7)

Configuration file

intro_configuration.html

First one found from of

@elasticdog
elasticdog / vault-cp
Created July 27, 2018 18:32
A script to copy Vault secrets from one path to another
#!/usr/bin/env bash
# ensure we were given two command line arguments
if [[ $# -ne 2 ]]; then
echo 'usage: vault-cp SOURCE DEST' >&2
exit 1
fi
source=$1
dest=$2
@AlexandraKapp
AlexandraKapp / osrm_docker_windows.md
Last active May 3, 2024 08:53
How to set up your own OSRM backend with Docker on Windows

How to set up your own OSRM backend with Docker on Windows

The OSRM docker quick start provides a great explanation on how to set up the container: https://hub.docker.com/r/osrm/osrm-backend/

Yet - for Docker on Windows minor changes were necessary for me (otherwise I'd get "File not found" or "Permission" errors).

This is how it worked for me:

1. Pull the image

@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active May 3, 2024 08:51
国内的 Docker Hub 镜像加速器,由国内教育机构与各大云服务商提供的镜像加速服务 | Dockerized 实践 https://github.com/y0ngb1n/dockerized

Docker Hub 镜像加速器

国内从 Docker Hub 拉取镜像有时会遇到困难,此时可以配置镜像加速器。Docker 官方和国内很多云服务商都提供了国内加速器服务。

Dockerized 实践 https://github.com/y0ngb1n/dockerized

配置加速地址

Ubuntu 16.04+、Debian 8+、CentOS 7+

@codedokode
codedokode / !Как установить сфинкс.md
Last active May 3, 2024 08:50
Как установить и настроить сфинкс.

Как установить и настроить сфинкс.

Скачиваем сфинкс (берем версию с MySQL и со стеммингом на 15 языков Win32 binaries w/MySQL+PgSQL+libstemmer+id64 support соответствующую битности твоей ОС), распаковываем например в d:\temp\s\

На этом установка sphinx завершена. В дебиане просто делаем sudo apt-get install sphinxsearch.

Создаем таблицы:

CREATE TABLE news 

(id INT(10) AUTO_INCREMENT PRIMARY KEY, topic INT(10) NOT NULL, header VARCHAR(200) NOT NULL,

@markasoftware
markasoftware / enterprise_token.rb
Last active May 3, 2024 08:48
OpenProject Enterprise mode for free
############ REPLACE app/models/enterprise_token.rb in the source code with this file! ################
############ also be sure to RESTART OpenProject after replacing the file. ################
############ it doesn't show that enterprise mode is enabled in the settings, but all ################
############ enterprise mode features, such as KanBan boards, are enabled. ################
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2023 the OpenProject GmbH
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License version 3.
@jahe
jahe / jpa-cheatsheet.java
Last active May 3, 2024 08:48
JPA Cheatsheet
/*
JPA (Java Persistence API)
Transaction Management with an Entity-Mananger:
---
entityManager.getTransaction().begin();
entityManager.persist(<some-entity>);
entityManager.getTransaction().commit();
entityManager.clear();
@ghostbear
ghostbear / Spotify - How to reduce and limit the cache size (Windows - Mac).md
Last active April 9, 2024 11:07
[Spotify] How to limit the cache size (Windows/Mac OS)

Credit to MadHatter

WINDOWS

Use your text editor of choice or if you don't have one use Windows Notepad
Opening with Notepad may or may not result in a fancy mess

  1. Close Spotify
  2. Open File Explorer and paste the following into the address bar %appdata%/Spotify¤
  3. Open the file named prefs with your text editor
  4. Change the numeric value following storage.size= . If storage.size= doesn't exist add it manually to the end of the file and assign numeric value. This value represents megabytes. One gigabyte equals 1024 megabytes. In the end, it should look something like this storage.size=1024
  5. Save the file
@chitchcock
chitchcock / 20111011_SteveYeggeGooglePlatformRant.md
Created October 12, 2011 15:53
Stevey's Google Platforms Rant

Stevey's Google Platforms Rant

I was at Amazon for about six and a half years, and now I've been at Google for that long. One thing that struck me immediately about the two companies -- an impression that has been reinforced almost daily -- is that Amazon does everything wrong, and Google does everything right. Sure, it's a sweeping generalization, but a surprisingly accurate one. It's pretty crazy. There are probably a hundred or even two hundred different ways you can compare the two companies, and Google is superior in all but three of them, if I recall correctly. I actually did a spreadsheet at one point but Legal wouldn't let me show it to anyone, even though recruiting loved it.

I mean, just to give you a very brief taste: Amazon's recruiting process is fundamentally flawed by having teams hire for themselves, so their hiring bar is incredibly inconsistent across teams, despite various efforts they've made to level it out. And their operations are a mess; they don't real