Skip to content

Instantly share code, notes, and snippets.

View dkbast's full-sized avatar

Damian Bast dkbast

View GitHub Profile
@maks
maks / pre-push
Last active October 22, 2020 10:41 — forked from miquelbeltran/pre-push
Flutter pre-push hook that runs analyze and test
#!/bin/sh
# To use add to `.git/hooks/`
# Should be named `pre-push`
# Make executable with `chmod +x`
# ref: https://gist.github.com/maks/edb25da8706cb04f45ebfdd278d91791
# run Flutter analyze + test
flutter analyze
if [ $? -ne 0 ]; then
echo 'cannot push: Flutter analyze failed'
@jeroen-meijer
jeroen-meijer / flutterrepair.sh
Last active August 23, 2023 04:05
Flutter Repair iOS - When your Flutter build comes up with weird Xcode errors, run this script from your Flutter project directory and it will clean out all the old iOS stuff and get your project dependencies fresh.
#!/bin/sh
# To run, download the script or copy the code to a '.sh' file (for example 'flutterrepair.sh') and run like any other script:
# sh ./flutterrepair.sh
# or
# sudo sh flutterrepair.sh
echo "Flutter Repair (by jeroen-meijer on GitHubGist)"
echo Cleaning project...
@sam016
sam016 / AllGattCharacteristics.java
Last active May 4, 2024 20:46
Bluetooth GATT Services & Characteristics
package com.sam016.vsflatomation.service.ble;
import java.util.HashMap;
import java.util.UUID;
public class AllGattCharacteristics {
private static HashMap<String, String> attributes = new HashMap();
static {
attributes.put("00002a00-0000-1000-8000-00805f9b34fb", "Device Name");
@pbugnion
pbugnion / ipython_notebook_in_git.md
Last active October 22, 2023 12:25
Keeping IPython notebooks under Git version control

This gist lets you keep IPython notebooks in git repositories. It tells git to ignore prompt numbers and program outputs when checking that a file has changed.

To use the script, follow the instructions given in the script's docstring.

For further details, read this blogpost.

The procedure outlined here is inspired by this answer on Stack Overflow.

@xingrz
xingrz / RealmAdapter.java
Last active May 22, 2020 19:46
A RecyclerView.Adapter-like Adapter that binds RealmResults to ListView
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import io.realm.RealmObject;
import io.realm.RealmResults;
public abstract class RealmAdapter<E extends RealmObject, VH extends RealmAdapter.ViewHolder>
extends BaseAdapter {
@mqu
mqu / usb-auto-backup
Last active October 3, 2023 14:43
usb-auto-backup script - a script connected to UDEV daemon, running rsync backup when user insert USB drive.
TODO :
- manage user notification ; notify-send not really working ; current alternative either.
- display hostid used to customize usb backup script.
INSTALL
- copy usb-auto-backup script to /usr/local/bin,
- create an partition on an USB drive named "backup" ; get id (/dev/sddX) -> will be needed in udev.rules
- identity your drive information for UDEV-rules using : udevadm info -a -p $(udevadm info -q path -n /dev/sdXX)
- create an UDEV rule : /etc/udev/rules.d/99-usb-auto-backup.rules like this one :
@benui-dev
benui-dev / gist:6111355
Created July 30, 2013 08:51
Unity C# snippets for Vim Snipmate
snippet find
GameObject.Find("${1}")${2}
snippet gc
GetComponent<${1}>()
snippet ac
AddComponent<${1}>()
snippet sar
SetActiveRecursively(${1:true})
snippet rc
[RequireComponent (typeof(${1:AudioSource}))]
// Built with IMPACT - impactjs.org
(function (window) {
"use strict";
Number.prototype.map = function (istart, istop, ostart, ostop) {
return ostart + (ostop - ostart) * ((this - istart) / (istop - istart));
};
Number.prototype.limit = function (min, max) {
return Math.min(max, Math.max(min, this));
};
Number.prototype.round = function (precision) {
@ivoba
ivoba / WikipediaMarkupCoordinates.php
Created December 20, 2011 09:21
parse Coordinates and convert to Lat/Lon from Wikipedia Markup
<?php
class WikipediaMarkupCoordinates{
/**
* @param string $text
* @return boolean|array
*
* bsp: http://de.wikipedia.org/w/api.php?action=query&prop=revisions&rvprop=content&format=json&titles=Berufskolleg_Deutzer_Freiheit
*/
public static function parseCoordinatesFromInfobox($text) {
@steren
steren / index.html
Created November 18, 2010 02:24
call Wikipedia API using jQuery and parse result
<div id="insertTest"></div>
<script>
var wikipediaHTMLResult = function(data) {
var readData = $('<div>' + data.parse.text.* + '</div>');
// handle redirects
var redirect = readData.find('li:contains("REDIRECT") a').text();
if(redirect != '') {
callWikipediaAPI(redirect);