Skip to content

Instantly share code, notes, and snippets.

View MTRNord's full-sized avatar
🏠
Working from home

Marcel MTRNord

🏠
Working from home
View GitHub Profile
@schacon
schacon / better-git-branch.sh
Created January 13, 2024 18:41
Better Git Branch output
#!/bin/bash
# Colors
RED='\033[0;31m'
GREEN='\033[0;32m'
NO_COLOR='\033[0m'
BLUE='\033[0;34m'
YELLOW='\033[0;33m'
NO_COLOR='\033[0m'
@nomrik
nomrik / API_flow_saga.md
Last active April 19, 2023 20:18
API requests flow with Redux Saga

API requests flow

Introduction

In Redux, API requests are considered side effects, outside the regular Redux flow. Thus, they are normally handled by a middleware. Out of the many libraries available, one of the most popular is Redux Saga. Redux Saga has two main advantages over the other options:

  • It is built around JavaScript's generator functions, which make it possible to write async logic in a way that is easy to reason about.
  • It is easy to test.
  • When using it, all of the Redux actions are always just plain objects, unlike other middleware libraries which require async actions to be functions. That way it is possible to keep the standard Redux Flow, dispatching just regular actions. If the action is supposed to trigger async logic, the middleware will handle it.

This document is meant to descr

@ara4n
ara4n / perl.md
Last active July 16, 2021 09:49
Everything you need to know about Perl5

I once wrote one of these before for @NegativeMjark but I think I lost it. So here's another.

All you need to know is:

  • $foo is a scalar (i.e. a single dimensional variable)
  • @foo is an array. $foo[n] is the element of an array.
  • %foo is a hash. $foo{'moo'} aka $foo{moo} is the value in the hash for key 'foo'.
  • \ is the reference operator. it returns a scalar which points to the address of the variable (like & in C).
  • (1, 2, 3) is a list. (an array is a variable which contains a list).
  • [1, 2, 3] (rarely: \(1,2,3)) is a reference to a list - aka arrayref
  • $foo->[n] gives an element of an arrayref
@hemalchevli
hemalchevli / bluepill.cfg
Last active July 24, 2023 11:57
OpenOCD config file for Bluepill STM32F103C8T6
#source [find interface/stlink-v2-1.cfg]
source [find interface/stlink-v2.cfg]
transport select hla_swd
source [find target/stm32f1x.cfg]
#reset_config srst_only
reset_config none separate
@MTRNord
MTRNord / Lookup.md
Last active February 26, 2017 18:01

Requires plugin: lookup.sheetapi

NOTE: You need a Serviceaccount (explained below) and you need to share the sheet with it.

/bot lookup [<MAX] <keyword>

  • Need to enable in config: spreadsheet_enabled, spreadsheet_url and spreadsheet_credentials_file
  • spreadsheet_worksheet allows you to optionaly define the worksheet to use by name.
  • Will look up each row of a spreadsheet and if the keyword is found will return the whole row
  • if
# This should be the public-facing name (ie: dns name)
HOME_SERVER_URL="https://matrix.org"
# The room ID is NOT the room alias. The ID can be found at the bottom of the room settings dialog in riot-web
ROOM_ID="!AbCDef823s:matrix.org"
# This is your user ID and access token. The access token must match the user.
USER_ID="@turt2live:matrix.org" # The home server should match this domain as well (ie: t2l.io as a HS should be :t2l.io in the user)
ACCESS_TOKEN="token_here"
@nornagon
nornagon / 1-intro.md
Last active April 20, 2024 18:48
How to make a Minecraft (1.8) mod

How to make a Minecraft mod

Minecraft mods, especially mods which change the client, are by and large written with Forge. If you visit their website, you'll be greeted abruptly by a mysterious message at the top of an SMF forum, with no clear path towards actually... making a mod. I'm documenting here the steps I went through to get started, in the hopes of helping the next person have an easier time of it.

I'll be using Scala for this guide, but it should be fairly easy to adapt these instructions to any JVM language (e.g. clojure or if you're feeling masochistic, Java). I'm also developing on OS X, so some of the commands will be a little different if you're on Linux or Windows. I'm assuming you have some proficiency with your operating system, so I won't go into details about how to adapt those commands to your system.

Background

Minecraft doesn't have an official mod API (despite early [promises](http://notch.t

@quantenProjects
quantenProjects / server_status.py
Created March 14, 2016 17:54
simple server status check for https://github.com/hangoutsbot/hangoutsbot don't forget to activate the plugin in the config
"""
execute w and df -h on server
"""
import plugins
import subprocess
def _initialize(bot):
plugins.register_admin_command(['w'])
plugins.register_admin_command(['df'])
@MTRNord
MTRNord / build_nginx.sh
Last active August 5, 2016 21:19 — forked from MattWilcox/build_nginx.sh
Fetch, build, and install the latest nginx with the latest OpenSSL for RaspberryPi
#!/usr/bin/env bash
# names of latest versions of each package
export VERSION_PCRE=pcre-8.32
export VERSION_OPENSSL=openssl-1.0.2h
export VERSION_NGINX=nginx-1.11.3
# URLs to the source directories
export SOURCE_OPENSSL=https://www.openssl.org/source/
export SOURCE_PCRE=ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
@PurpleBooth
PurpleBooth / README-Template.md
Last active May 3, 2024 18:53
A template to make good README.md

Project Title

One Paragraph of project description goes here

Getting Started

These instructions will get you a copy of the project up and running on your local machine for development and testing purposes. See deployment for notes on how to deploy the project on a live system.

Prerequisites