Skip to content

Instantly share code, notes, and snippets.

View gelldur's full-sized avatar
🎯
Focusing

Gelldur gelldur

🎯
Focusing
View GitHub Profile
#!/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))
import android.support.annotation.Nullable;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentStatePagerAdapter;
import java.util.ArrayList;
import java.util.Arrays;
public class CyclicPagesAdapter extends FragmentStatePagerAdapter {
@gelldur
gelldur / RoundedTransformation.java
Last active March 23, 2016 08:32 — forked from aprock/RoundedTransformation.java
Rounded Corner Image Transformation for square's Picasso
import android.graphics.Bitmap;
import android.graphics.Bitmap.Config;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Shader;
// enables hardware accelerated rounded corners
// original idea here : http://www.curious-creature.org/2012/12/11/android-recipe-1-image-with-rounded-corners/
@gelldur
gelldur / onEnter checker
Last active August 29, 2015 14:14
Chcking for onEnter method
template<typename T>
struct has_onEnter
{
private:
template<typename U>
static auto test(int) -> decltype(std::declval<U>().onEnter(), std::true_type
{});
template<typename >
static std::false_type test(...);