Skip to content

Instantly share code, notes, and snippets.

@lynchjames
lynchjames / deploy.cmd
Last active May 4, 2024 16:36
Preparing Obsidian vault for pushing to Azure DevOps Wiki
echo 'Copying attachment files into .attachments folder'
cp attachments/* .attachments/
echo 'Updating attachment links'
find . -type f -name "*.md" -print0 | xargs -0 sed -i 's/(attachments\//(\/\.attachments\//g'
@wojteklu
wojteklu / clean_code.md
Last active May 4, 2024 16:35
Summary of 'Clean code' by Robert C. Martin

Code is clean if it can be understood easily – by everyone on the team. Clean code can be read and enhanced by a developer other than its original author. With understandability comes readability, changeability, extensibility and maintainability.


General rules

  1. Follow standard conventions.
  2. Keep it simple stupid. Simpler is always better. Reduce complexity as much as possible.
  3. Boy scout rule. Leave the campground cleaner than you found it.
  4. Always find root cause. Always look for the root cause of a problem.

Design rules

@romkatv
romkatv / Pure style for Powerlevel10k.md
Last active May 4, 2024 16:34
Pure style for Powerlevel10k

Powerlevel10k can generate the same prompt as Pure.

pure

Installation

git clone https://github.com/romkatv/powerlevel10k.git ~/powerlevel10k
echo 'source ~/powerlevel10k/powerlevel10k.zsh-theme' >>! ~/.zshrc
@hoandang
hoandang / php-docker-ext
Created May 20, 2017 01:12
Complete list of php docker ext
RUN apt update
RUN apt upgrade -y
RUN apt install -y apt-utils
RUN a2enmod rewrite
RUN apt install -y libmcrypt-dev
RUN docker-php-ext-install mcrypt
RUN apt install -y libicu-dev
RUN docker-php-ext-install -j$(nproc) intl
RUN apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng12-dev
RUN docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
@y0ngb1n
y0ngb1n / docker-registry-mirrors.md
Last active May 4, 2024 16:31
国内的 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+

@Sohamsk
Sohamsk / graph_colouring_backtracking.py
Last active May 4, 2024 16:23
Solving backtracking problem
def is_safe(graph, colours, colour, current):
neighbours = graph[current]
for neighbour in neighbours:
if colour == colours[neighbour - 1]:
return False
return True
def graph_traversal(graph, colours, vertices, current):
if current == vertices + 1:
return True
@Sohamsk
Sohamsk / djikstra.py
Last active May 4, 2024 16:23
This gist is meant to store code related to greedy algorithms
import heapq
from typing import List
def djikstra(graph_inner, starting, vertices) -> List:
pq = []
dist = [float('inf') for i in range(vertices)]
dist[starting] = 0
print(dist)
heapq.heappush(pq, [0, starting])
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Sohamsk
Sohamsk / Astar.py
Last active May 4, 2024 16:22
Solving 8 puzzle problem using A star algorithm.
class Node:
def __init__(self, data: list, level, f_val):
self.data = data
self.level = level
self.f_val = f_val
def generate_children(self):
children = []
values = [[0, 1], [1, 0], [-1, 0], [0, -1]]
row, col = self.find()