Skip to content

Instantly share code, notes, and snippets.

View coolya's full-sized avatar

Kolja Dummann coolya

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<remote name="private" fetch="git://github.com/"/>
<project path="vendor/broadcom" name="koush/proprietary_vendor_broadcom" remote="private" />
<project path="vendor/bn" name="koush/proprietary_vendor_bn" remote="private" />
<project path="vendor/htc" name="koush/proprietary_vendor_htc" remote="private" />
<project path="vendor/imgtec" name="koush/proprietary_vendor_imgtec" remote="private" />
<project path="vendor/google" name="koush/proprietary_vendor_google" remote="private" revision="gh-pages" />
<project path="vendor/lge" name="koush/proprietary_vendor_lge" remote="private" />
var config = new IConfiguration() {Path = "meh", Root = "foo" }; // where IConfiguration is a Interface
class GenricCmdLineParser
{
private Dictionary<string, Action<string>> Entries = new Dictionary<string, Action<string>>();
protected void Register(string arg, Action<string> valueSetter)
{
if (!Entries.ContainsKey(arg))
Entries.Add(arg.ToLowerInvariant(), valueSetter);
}
@coolya
coolya / gist:2953039
Created June 19, 2012 08:36
Convert number to a higher base
x= 2547, y = 8, x * 10 ^ ((y - 1) - (int(log10(x)))
@coolya
coolya / gist:3551118
Created August 31, 2012 10:13
EnumerableExtensions.cs
public static class EnumerableExtensions
{
public static BlockingCollection<T> CopyToBlockingCollectionAsync<T>(this IEnumerable<T> source)
{
var collection = new BlockingCollection<T>();
Task.Factory.StartNew(() =>
{
foreach (var item in source)
{
@coolya
coolya / gist:3621884
Created September 4, 2012 14:48
Objectgraph
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Reflection;
using System.Text;
namespace ConsoleApplication1
{
class Program
struct DataStructures_Trackpoint (*foo)(struct DataStructures_Trackpoint);
if ( !((*foo)(i1).alt == 100) )
{
(*__failures)++;;
printf("$$FAILED: ***FAILED*** (");
printf("testID=%i",0);
printf(") @FunctionPointers:testLambdaProcessing:0#6864902200221979870\n");
}
@coolya
coolya / check notification permission
Last active September 10, 2020 02:43
How to check if you app has permission to get notification service listener
boolean hasNotificationAccess()
{
ContentResolver contentResolver = this.getContentResolver();
String enabledNotificationListeners = Settings.Secure.getString(contentResolver, "enabled_notification_listeners");
String packageName = this.getPackageName();
// check to see if the enabledNotificationListeners String contains our package name
return !(enabledNotificationListeners == null || !enabledNotificationListeners.contains(packageName));
}
@coolya
coolya / gist:1fccef3591086bd7ba7d
Last active August 29, 2015 14:04
High Performance Loggin
using logv.http;
using logv.ws.core;
using System;
using System.Collections.Concurrent;
using System.Threading.Tasks;
using MongoDB.Bson;
using logv.ws.core.data;
namespace logv.host
{
wget https://opscode-omnibus-packages.s3.amazonaws.com/debian/6/x86_64/chef_11.16.4-1_amd64.deb [17:22:03]
--2014-10-24 17:22:04-- https://opscode-omnibus-packages.s3.amazonaws.com/debian/6/x86_64/chef_11.16.4-1_amd64.deb
Resolving opscode-omnibus-packages.s3.amazonaws.com... 54.231.16.25
Connecting to opscode-omnibus-packages.s3.amazonaws.com|54.231.16.25|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 31437864 (30M) [application/x-debian-package]
Saving to: 'chef_11.16.4-1_amd64.deb'
100%[======================================================================================================================================================================================================================================>] 31,437,864 2.27MB/s in 21s