Skip to content

Instantly share code, notes, and snippets.

@monossido
monossido / chan_gtalk.diff
Created January 31, 2012 12:48
SIP-to-XMPP with Android Gtalk client (jingle capable no)
--- chan_gtalk.c 2011-11-23 18:14:41.000000000 +0100
+++ chan_gtalkmio.c 2012-01-31 13:31:59.592839682 +0100
@@ -1020,7 +1020,10 @@ static struct gtalk_pvt *gtalk_alloc(str
}
while (resources) {
- if (resources->cap->jingle) {
+ int n = strncmp(resources->resource, "android_talk", 11);
+ if (resources->cap->jingle || n==0 ) {
+ if(n==0)
@monossido
monossido / chan_gtalk_final.diff
Created February 2, 2012 18:48
XMPP-to-SIP with Android Gtalk client (that creates mess with tags)
--- chan_gtalk1.8.c 2012-02-01 00:47:22.874993607 +0100
+++ chan_gtalk1.8-mio-final.c 2012-02-02 19:38:32.873555093 +0100
@@ -1997,6 +1997,11 @@ static int gtalk_parser(void *data, iksp
pak->query = tmp;
}
+ if (!strcasecmp(iks_name(pak->query), "jingle") && (tmp = iks_next(pak->query)) && !strcasecmp(iks_name(tmp), "session")) {
+ ast_debug(1, "New method detected. Skipping jingle offer and using old gtalk method.\n");
+ pak->query = tmp;
+ }
@monossido
monossido / chan_gtalk_final2.diff
Created February 2, 2012 20:04
XMPP-to-SIP with Android Gtalk client (that creates mess with tags) - Outgoing calls
--- chan_gtalk1.8-mio-final.c 2012-02-03 11:31:42.754279386 +0100
+++ chan_gtalk1.8-mio-final2.c 2012-02-02 21:02:02.874390985 +0100
@@ -610,14 +610,22 @@ static int gtalk_is_answered(struct gtal
iks *codec;
char s1[BUFSIZ], s2[BUFSIZ], s3[BUFSIZ];
int peernoncodeccapability;
+ iks *tmp2;
ast_log(LOG_DEBUG, "The client is %s\n", client->name);
@monossido
monossido / ScaleInAnimation.java
Created December 2, 2014 23:30
Animate a view by scaling in it. Such dialer in Lollipop.Requires API level 21. Credit AOSP.
/**
* * Scales in the view from scale of 0 to actual dimensions.
* * @param view The view to scale.
* * @param durationMs The duration of the scaling in milliseconds.
* * @param startDelayMs The delay to applying the scaling in milliseconds.
*/
public static void scaleIn(final View view, int durationMs, int startDelayMs) {
AnimatorListenerAdapter listener = (new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
@monossido
monossido / send_gcm
Created July 3, 2015 10:36
Test GCM message
#!/bin/bash
#tablet
REGISTRATION_ID=
SERVER_KEY=
#force_ping
curl --header "Authorization: key=$SERVER_KEY" --header Content-Type:"application/json" https://android.googleapis.com/gcm/send -d "{ \"data\" : "somedata", \"registration_ids\":[\"$REGISTRATION_ID\"] }"
@monossido
monossido / CustomEmailValidator.java
Last active April 28, 2016 11:23
Custom Email Validator (with MX support) for saripaar android library //compile 'javax.jmdns:jmdns:3.4.1' in build.gradle
package com.unipiazza.restlibrary.customsaripaar;
//compile 'javax.jmdns:jmdns:3.4.1' in build.gradle
import org.xbill.DNS.Lookup;
import org.xbill.DNS.Record;
import org.xbill.DNS.TextParseException;
import org.xbill.DNS.Type;
import java.io.Serializable;
import java.util.regex.Matcher;
@monossido
monossido / blackbird_issue_428.patch
Last active May 8, 2018 10:48
[Blackbird] Kraken issue on getActivePos (with eur)
diff --git a/src/exchanges/kraken.cpp b/src/exchanges/kraken.cpp
index 902dfa1..7a69f5a 100644
--- a/src/exchanges/kraken.cpp
+++ b/src/exchanges/kraken.cpp
@@ -18,6 +18,7 @@ namespace Kraken
static unique_json krakenTicker = nullptr;
static bool krakenGotTicker = false;
+double shortOrderVolume = 0.0;
@monossido
monossido / cache.js
Last active May 16, 2022 10:10
Using Redis with Nodejs, MongoDB and mongoose. With normal Query and also Aggregate.
/*
* Based on @subhrapaladhi tutorial
* https://github.com/subhrapaladhi/Node-Redis-Mongo-app https://subhrapaladhi.medium.com/using-redis-with-nodejs-and-mongodb-28e5a39a2696
* I've changed some logic (I'm not returning the data as mongoose Model due to performance concern)
* and includedd the support for Aggregation.
* Also I'm using the redis 4.* command.
*/
const mongoose = require("mongoose");
const redis = require("redis");
const config = require("./../../config.js");