Skip to content

Instantly share code, notes, and snippets.

View holysheep's full-sized avatar

Alexandra holysheep

  • Utrecht, Netherlands
View GitHub Profile
@vikpe
vikpe / fix_authenticity_of_github_problem.md
Last active May 2, 2024 16:22
FIX: The authenticity of host github.com can't be established.

Error

The authenticity of host 'github.com (140.82.113.4)' can't be established.

Fix

ssh-keyscan github.com >> ~/.ssh/known_hosts
@scragly
scragly / discord_emoji.md
Last active September 3, 2023 10:07
Emoji for Discord Bots

Discord Emoji

Note: This is written for those using Python 3 and discord.py, so if you're using something else please reference the relevant documentation for your language or library if you choose to use this as a general reference.

On Discord, there are two different emoji types:

Each needs to be handled differently, as while unicode emoji are just simple unicode characters, Discord custom emoji are special objects available only in Discord, belonging to a specific Discord guild and having their own snowflake ID.

@DasWolke
DasWolke / microservice bots.md
Last active March 23, 2024 16:41
Microservice bots

Microservice Bots

What they are and why you should use them

Introduction

Recently more and more chatbots appear, the overall chatbot market grows and the platform for it grows as well. Today we are taking a close look at what benefits creating a microservice chatbot on Discord - (a communication platform mainly targeted at gamers) would provide.

The concepts and ideas explained in this whitepaper are geared towards bots with a bigger userbase where the limits of a usual bot style appear with a greater effect

Information about Discord itself

(If you are already proficient with the Discord API and the way a normal bot works, you may skip ahead to The Concept)

@Ahmed-Adel-Ismail
Ahmed-Adel-Ismail / IfElse.java
Last active February 8, 2024 14:44
Observable Operators that enables switch-case and if-else in RxJava stream, you can use them with lift() operator, and pass to them a Map of key/function , if the key is matched with the emitted item, it's function will be executed and it's value will be returned in the stream
/**
* an {@link ObservableOperator} that simulates an if-else in an RxJava Stream, it takes a {@link Map}
* of {@link Predicate} as key and a {@link Function} as value ... the if any emitted item passes
* the {@link Predicate}, this emitted item will be passed to the {@link Function} mapped to it,
* and this item will be invoked and it's result will continue down the stream
* <p>
* sample code :
* <p>
* {@code List<Integer> list = Arrays.asList(1, 2, 3, 4, 5, 6, 7, 8);}<br>
* {@code Map<Predicate<Integer>, Function<Integer, String>> blocks = new LinkedHashMap<>(2)}<br>
@timdorr
timdorr / MainApplication.java
Created February 11, 2017 14:36
Tesla App is now React Native!
package com.teslamotors.TeslaApp;
import android.app.Application;
import com.BaiduMaps.BaiduPackage;
import com.airbnb.android.react.maps.MapsPackage;
import com.facebook.react.ReactApplication;
import com.facebook.react.ReactNativeHost;
import com.facebook.react.ReactPackage;
import com.facebook.react.shell.MainReactPackage;
import com.i18n.reactnativei18n.ReactNativeI18n;
package com.tunjid.demo.Util;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.support.annotation.ColorRes;
import android.support.annotation.DrawableRes;
@gunjanpatel
gunjanpatel / revert-a-commit.md
Last active May 3, 2024 20:50
Git HowTo: revert a commit already pushed to a remote repository

Revert the full commit

Sometimes you may want to undo a whole commit with all changes. Instead of going through all the changes manually, you can simply tell git to revert a commit, which does not even have to be the last one. Reverting a commit means to create a new commit that undoes all changes that were made in the bad commit. Just like above, the bad commit remains there, but it no longer affects the the current master and any future commits on top of it.

git revert {commit_id}

About History Rewriting

Delete the last commit

Deleting the last commit is the easiest case. Let's say we have a remote origin with branch master that currently points to commit dd61ab32. We want to remove the top commit. Translated to git terminology, we want to force the master branch of the origin remote repository to the parent of dd61ab32:

@ed-george
ed-george / AppBarStateChangedListener.java
Last active July 13, 2022 12:05
Simple listener to determine if the AppBarLayout of a view is collapsed or expanded
public abstract class AppBarStateChangedListener implements AppBarLayout.OnOffsetChangedListener {
public enum State {
EXPANDED,
COLLAPSED,
IDLE
}
private State mCurrentState = State.IDLE;
@23maverick23
23maverick23 / heroku_commands.sh
Last active July 12, 2022 15:39
Bash: Heroku bash commands
# Heroku Django Commands #
# ---------------------- #
# Push local git changes to heroku
git push heroku master
# Login to heroku via toolbelt
heroku login
# View heroku processes
public Bitmap blurBitmap(Bitmap bitmap){
//Let's create an empty bitmap with the same size of the bitmap we want to blur
Bitmap outBitmap = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), Config.ARGB_8888);
//Instantiate a new Renderscript
RenderScript rs = RenderScript.create(getApplicationContext());
//Create an Intrinsic Blur Script using the Renderscript
ScriptIntrinsicBlur blurScript = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));