Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View gelldur's full-sized avatar
🎯
Focusing

Gelldur gelldur

🎯
Focusing
View GitHub Profile
@gelldur
gelldur / Grafana Alert Template.md
Last active April 18, 2024 07:17 — forked from Himura2la/Grafana Alert Template.md
How to use Grafana Alerts with the Telegram
  • Template name: telegram.message
  • Content:
    {{- /* Telegram message to use: {{ template "telegram.message2" . }} */ -}}
    {{ define "__alerts_list" -}}
    {{ range . }}
    {{if ne (index .Labels "alertname") "" -}}
    {{ if eq .Status "firing" }}🔴{{ else }}🟢{{ end }}
        {{- if ne (index .Labels "severity") "" -}}
            <u><b>P{{ index .Labels "severity" }}</b></u> {{ end -}}
@gelldur
gelldur / docker_logs_grep
Created April 18, 2020 08:44
[Grep docker logs] #docker #logs #error #grep
docker logs $container 2>&1 | grep -P "\[(W|E)\]"
Example:
```
04-16 22:04:19.222 [E](StatsApp) Animation has no fills: 1 in 0
04-16 22:27:24.239 [E](StatsApp) Animation has no fills: 1 in 0
```
@gelldur
gelldur / what_i_was_doing_in_last_2w.jql
Last active April 10, 2019 08:53
JQL filter (Jira filter) For what I was doing in last 2 weeks
assignee was currentUser() during (startOfDay(-2w), now()) AND updated >= startOfDay(-2w) AND ( resolutiondate is EMPTY OR resolutiondate >= startOfDay(-2w) )
#!/bin/python3
import urllib.request
import time
import datetime
import subprocess
from html.parser import HTMLParser
from pprint import pprint
watch '{ nvidia-smi -q -d temperature | grep "GPU Current Temp"; sensors; }'
@gelldur
gelldur / abucoins_api.py
Created December 5, 2017 23:40
Abucoins sample api call
import json, hmac, hashlib, time, requests, base64
from requests.auth import AuthBase
class AbuCoins(AuthBase):
def __init__(self, api_key, secret_key, passphrase):
self.api_key = api_key
self.secret_key = secret_key
self.passphrase = passphrase
def __call__(self, request):
@gelldur
gelldur / pre-commit-clang-format
Created August 3, 2017 06:31 — forked from comenix/pre-commit-clang-format
Git pre-commit hook that invokes clang-format to reformat C/C++/Objective-C source code.
#!/bin/bash
# git pre-commit hook that runs an clang-format stylecheck.
# Features:
# - abort commit when commit does not comply with the style guidelines
# - create a patch of the proposed style changes
# modifications for clang-format by rene.milk@wwu.de
# This file is part of a set of unofficial pre-commit hooks available
# at github.
#include <iostream>
#include <algorithm>
#include <cstring>
template<class T, class UnaryPredicate>
void reverseStringExtra(T& text, const UnaryPredicate& predicate)
{
auto previousPivot = std::begin(text);
auto pivot = previousPivot;
while ((pivot = std::find_if(pivot, std::end(text), predicate)) != std::end(text))
@gelldur
gelldur / emulator-fix
Created November 15, 2016 08:46
Fix for android emulator -noaudio and CPU problems
#!/bin/bash
# http://stackoverflow.com/a/35822173/1052261
# http://stackoverflow.com/questions/59895/can-a-bash-script-tell-what-directory-its-stored-in
SOURCE="${BASH_SOURCE[0]}"
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
SOURCE="$(readlink "$SOURCE")"
[[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
done
@gelldur
gelldur / convertRes.py
Created June 27, 2016 14:45
Script converting android res folder to ios assets. Eg. from res to Assets.xcassets
#!/usr/bin/python
import sys
import os
import json
from shutil import copyfile
print('Number of arguments:', len(sys.argv), 'arguments.')
if len(sys.argv) < 3: