adduser <user>
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NotifyingLinearLayoutManager(context: Context?) : LinearLayoutManager(context, VERTICAL, false) { | |
var onLayoutCompleteCallback: OnLayoutCompleteCallback? = null | |
override fun onLayoutCompleted(state: RecyclerView.State?) { | |
super.onLayoutCompleted(state) | |
onLayoutCompleteCallback?.onLayoutComplete() | |
} | |
fun isLastItemCompletelyVisible() = findLastCompletelyVisibleItemPosition() == itemCount - 1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NotifyingGridLayoutManager(context: Context?) : GridLayoutManager(context, 1) { | |
var onLayoutCompleteCallback: OnLayoutCompleteCallback? = null | |
override fun onLayoutCompleted(state: RecyclerView.State?) { | |
super.onLayoutCompleted(state) | |
onLayoutCompleteCallback?.onLayoutComplete() | |
} | |
fun isLastItemCompletelyVisible() = findLastCompletelyVisibleItemPosition() == itemCount - 1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class AutoFitGrid : RecyclerView { | |
private var manager: GridLayoutManager? = null | |
private var columnWidth = -1 | |
constructor(context: Context) : super(context) { | |
initialization(context, null) | |
} | |
constructor(context: Context, attrs: AttributeSet) : super(context, attrs) { | |
initialization(context, attrs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class EventDispatcher: | |
def __init__(self): | |
self.__eventhandlers = {} | |
def add_event(self, event, handler): | |
self.__eventhandlers[event] = handler | |
def remove_event(self, event): | |
del self.__eventhandlers[event] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import gi | |
gi.require_version('Gtk', '3.0') | |
from gi.repository import Gtk, Gdk | |
import sys | |
class MyWindow(Gtk.ApplicationWindow): | |
def __init__(self, app): | |
Gtk.Window.__init__(self, title="Gtk get screen workarea", application=app) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This file can be used as an auto installer or you can mannually execute the steps yourself. | |
# If you use it as an installer, you must run it as root. | |
# Check if the script is run with sudo | |
if [ "$EUID" -ne 0 ] | |
then echo "Please run as root or with sudo" | |
exit | |
else | |
echo "Installing Erlang and Elixir..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This file can be used as an auto installer or you can mannually execute the steps yourself. | |
# If you use it as an installer, you must run it as root. | |
# Check if the script is run with sudo | |
if [ "$EUID" -ne 0 ] | |
then echo "Please run as root or with sudo" | |
exit | |
else | |
echo "Installing Mosquitto..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: 2010-09-09 | |
Transform: | |
- AWS::Serverless-2016-10-31 | |
Parameters: | |
RootDomainName: | |
Description: Domain name for your website | |
Type: String | |
Mappings: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def get_scaled_resolution( | |
self, | |
old_width: int = None, | |
old_height: int = None, | |
new_width: int = None, | |
new_height: int = None, | |
): | |
"""Returns the closest new resolution while preserving the aspect ratio. | |
You can specify new width, height or both. | |
It will automatically calculate the resolution. |
OlderNewer