Skip to content

Instantly share code, notes, and snippets.

View patriksima's full-sized avatar
👨‍💻
Happy coding

Patrik Šíma patriksima

👨‍💻
Happy coding
View GitHub Profile
@patriksima
patriksima / Program.cs
Created November 28, 2024 09:06
Osmisměrka
class WordSearchSolver
{
private static readonly (int, int)[] Directions =
[
(0, 1), (1, 0), (1, 1), (-1, 0), (0, -1), (-1, -1), (1, -1), (-1, 1)
];
private static List<List<(int, int)>> SearchWord(char[][] matrix, string word)
{
var rows = matrix.Length;
@patriksima
patriksima / StringsPermutation.cs
Created March 27, 2021 08:17
Check Permutation: Given two strings, write a method to decide if one is a permutation of the other.
using System;
using System.Diagnostics;
namespace StringsPermutation
{
/// <summary>
/// Check Permutation: Given two strings,
/// write a method to decide if one is a permutation of the other.
/// Let's assume that strings are ASCII, case-insensitive
/// </summary>
@patriksima
patriksima / BinaryGap.cs
Created March 22, 2021 18:38
BinaryGap algortihm Codility
public int solution(int N)
{
if (N < 5) return 0;
var bits = Convert.ToString(N, 2).Length;
int result = 0;
int gap = 0;
bool canCount = false;
# Install dependencies
NGINX_VERSION=1.10.1 && \
OPENSSL_VERSION=1.0.1t && \
NPS_VERSION=1.11.33.3 && \
sudo apt-get install unzip build-essential checkinstall git libpcre3 libpcre3-dev zlib1g zlib1g-dbg zlib1g-dev && \
mkdir -p ~/sources/ && \
@patriksima
patriksima / ssh_fwknop.py
Created July 27, 2017 11:39
Ansible fwknop ssh connection plugin
import subprocess
from ansible.plugins.connection.ssh import Connection as ConnectionSSH
from ansible.errors import AnsibleError
from socket import create_connection
from time import sleep
try:
from __main__ import display
except ImportError:
@patriksima
patriksima / nginx.conf
Created June 29, 2017 11:29 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance). Complete blog post here http://tautt.com/best-nginx-configuration-for-security/
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
root@deployer:/tmp# hdparm -tT /dev/sda
/dev/sda:
Timing cached reads: 18522 MB in 2.03 seconds = 9120.75 MB/sec
Timing buffered disk reads: 342 MB in 3.08 seconds = 111.10 MB/sec
root@deployer:/tmp# cat /proc/meminfo
MemTotal: 608680 kB
MemFree: 210448 kB
MemAvailable: 234308 kB
Buffers: 6128 kB