Skip to content

Instantly share code, notes, and snippets.

View Elijas's full-sized avatar

Elijas Dapšauskas Elijas

View GitHub Profile
@aras-p
aras-p / preprocessor_fun.h
Last active June 21, 2024 12:20
Things to commit just before leaving your job
// Just before switching jobs:
// Add one of these.
// Preferably into the same commit where you do a large merge.
//
// This started as a tweet with a joke of "C++ pro-tip: #define private public",
// and then it quickly escalated into more and more evil suggestions.
// I've tried to capture interesting suggestions here.
//
// Contributors: @r2d2rigo, @joeldevahl, @msinilo, @_Humus_,
// @YuriyODonnell, @rygorous, @cmuratori, @mike_acton, @grumpygiant,
@nicktoumpelis
nicktoumpelis / repo-rinse.sh
Created April 23, 2014 13:00
Cleans and resets a git repo and its submodules
git clean -xfd
git submodule foreach --recursive git clean -xfd
git reset --hard
git submodule foreach --recursive git reset --hard
git submodule update --init --recursive
@0xjac
0xjac / private_fork.md
Last active July 8, 2024 14:17
Create a private fork of a public repository

The repository for the assignment is public and Github does not allow the creation of private forks for public repositories.

The correct way of creating a private frok by duplicating the repo is documented here.

For this assignment the commands are:

  1. Create a bare clone of the repository. (This is temporary and will be removed so just do it wherever.)

git clone --bare git@github.com:usi-systems/easytrace.git

@primaryobjects
primaryobjects / m3u8.md
Last active June 18, 2024 07:53
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.
@hemna
hemna / install_pyenv.sh
Created April 10, 2019 17:53
install pyenv and then install python 3.6.3 in that pyenv
# !/bin/bash
# Step 1. Install pyenv
git clone https://github.com/pyenv/pyenv.git ~/.pyenv
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> ~/.bashrc
echo 'export PATH="$PYENV_ROOT/bin:$PATH"' >> ~/.bashrc
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval "$(pyenv init -)"\nfi' >> ~/.bashrc
source ~/.bashrc
@fworks
fworks / install-zsh-windows-git-bash.md
Last active July 2, 2024 08:16
Zsh / Oh-my-zsh on Windows Git Bash
@tyler-dot-earth
tyler-dot-earth / logid.cfg
Last active October 13, 2023 07:50
Logiops (Linux driver) configuration example for Logitech MX Master 3. Includes gestures, smartshift, DPI. Tested on logid v0.2.2-35-g1c209ed. File location: `/etc/logid.cfg`
// Logiops (Linux driver) configuration for Logitech MX Master 3.
// Includes gestures, smartshift, DPI.
// Tested on logid v0.2.2-35-g1c209ed.
// File location: /etc/logid.cfg
devices: ({
name: "Wireless Mouse MX Master 3";
smartshift: {
@Elijas
Elijas / g915-on-linux.md
Last active February 10, 2024 06:32
How to fix Logitech G915 going back to rainbow after sleep on Linux

How to fix the reset to rainbow lightning effect after keyboard wakes up from sleep

Install G HUB (Windows or MacOS), connect keyboard with Lightspeed, go to Settings, and set ON-BOARD MEMORY MODE to ON. This is a one-time setup for the lifetime of a keyboard.

Other features that work on Linux

Works out of the box:

  • All the media buttons, game mode (disables the Win key), volume control. In other words, all the buttons work.
  • Pressing cycles through brightness levels.
  • Pressing + [NUM] (where [NUM] is 0, 1, 2, ..., 9) allows you to change the lightning effect on the fly.
  • Pressing + - and + + changes the lightning effect speed for the non-custom effects.
@aseifert
aseifert / .python-environment.yml
Created March 22, 2022 08:22
default conda environment
channels:
- conda-forge
dependencies:
- python=3
- pip
# python libs
- pytest
- flake8
- black
- isort
@Elijas
Elijas / main.py
Last active October 7, 2022 18:56
EscapeTheJail
# Quick and dirty solution to the problem; code should be cleaned up
from pydtmc import MarkovChain
def solve_jail_escape(input_str):
input_ = [list(k) for k in input_str.split('\n')]
start_i, start_j = None, None
target_i, target_j = None, None
for i, row in enumerate(input_):