Skip to content

Instantly share code, notes, and snippets.

View MrModest's full-sized avatar

Kamil MrModest

View GitHub Profile
@ruanbekker
ruanbekker / promtail_docker_logs.md
Last active April 29, 2024 22:18
Docker Container Logging using Promtail
@triplepoint
triplepoint / _sshd_port_juggling.yml
Last active January 19, 2024 21:12
Ansible - fall back to a default ssh port if the configured ssh port fails
---
# This task list is intended to be imported by playbooks, before any
# other tasks are performed. It lets us determine whether the configured SSH
# port is available, and lets us fall back to the default port if necessary.
#
# The use case here is when a role in the playbook is configured to change the
# sshd port, but the first time the role is executed the host is still
# listening on the default port. With this check in place, we can fall back
# to the default port on the first run, and then on subsequent runs use the
# configured port.
@oidualc
oidualc / userChrome.css
Last active February 7, 2020 20:27
Firefox Client Side Decorations: close, minimize, maximize on the left
#TabsToolbar {
direction: rtl;
}
#tabbrowser-tabs {
direction: ltr;
}
.titlebar-buttonbox {
display: flex;
@primaryobjects
primaryobjects / m3u8.md
Last active May 6, 2024 21:14
How to download m3u8 and ts video movie streams.

m3u8 Downloading

  1. Open Chrome Developer tools and click the Network tab.
  2. Navigate to the page with the video and get it to start playing.
  3. Filter the list of files to "m3u8".
  4. Find master.m3u8 or index.m3u8 and click on it.
  5. Save the file to disk and look inside it.
  6. If the file contains a single m3u8 master url, copy that one instead.
  7. Run the program m3u8x.
  8. Paste the same m3u8 url in both textboxes (URL and Quality URL) and click "Headers" and set the referral url and user-agent from the request as found in Chrome.
@ismyrnow
ismyrnow / mac-clear-icon-cache.sh
Created May 5, 2017 19:28
Clear the icon cache on a Mac when you start seeing generic icons in Finder or the Dock
sudo rm -rfv /Library/Caches/com.apple.iconservices.store; sudo find /private/var/folders/ \( -name com.apple.dock.iconcache -or -name com.apple.iconservices \) -exec rm -rfv {} \; ; sleep 3;sudo touch /Applications/* ; killall Dock; killall Finder
@zmts
zmts / tokens.md
Last active May 6, 2024 20:13
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Last major update: 25.08.2020

  • Что такое авторизация/аутентификация
  • Где хранить токены
  • Как ставить куки ?
  • Процесс логина
  • Процесс рефреш токенов
  • Кража токенов/Механизм контроля токенов
@kiview
kiview / docker_volume_backup.sh
Last active January 18, 2024 12:25
Docker-Compose volume backup
#!/bin/bash
compose_file_path=$1
project_name=$2
backup_path=$3
function backup_volume {
volume_name=$1
backup_destination=$2
@weslleih
weslleih / date.extensions.ts
Last active November 11, 2023 08:00
Extend the TypeScript Date Object with some useful methods
export {}
declare global {
interface Date {
addDays(days: number, useThis?: boolean): Date;
isToday(): boolean;
clone(): Date;
isAnotherMonth(date: Date): boolean;
isWeekend(): boolean;
isSameDate(date: Date): boolean;
@JorjMcKie
JorjMcKie / LeoAccess.py
Last active March 7, 2023 22:24
Accessing dictionary dict.leo.org from Python
#!/usr/bin/env python
# -*- coding: latin-1 -*-
#
# Query the dictionary http://dict.leo.org/ from within Python.
# This is based on an equivalent script for German/English by:
#
# Copyright (C) 2015 Ian Denhardt <ian@zenhack.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@vkobel
vkobel / underscoreCase.cs
Created August 7, 2014 14:22
Simple C# extension method to convert a camel case string to underscore notation without any regex
public static class ExtensionMethods {
public static string ToUnderscoreCase(this string str) {
return string.Concat(str.Select((x, i) => i > 0 && char.IsUpper(x) ? "_" + x.ToString() : x.ToString())).ToLower();
}
}