Skip to content

Instantly share code, notes, and snippets.

View judepereira's full-sized avatar

Jude Pereira judepereira

View GitHub Profile
http server as client
when client listen path: '/github' as request
state = request.query_params['state'] # cli generated
redirect_url = 'https://login.asyncyapp.com/github/oauth_success'
request redirect url: 'https://github.com/login/oauth/authorize' query: {'scope': 'user:email', 'state': state, 'client_id': app.secrets.github_client_id, 'redirect_uri': redirect_url}
# Postback URL for the GH oauth, initiated via the CLI
# The URL should look something like this - https://login.asyncyapp.com/github/oauth_success
when client listen path:'/github/oauth_success' as request
state = request.query_params['state'] # cli generated
@judepereira
judepereira / a.story
Created October 22, 2018 12:47
hello world!
asd
package com.judepereira.jetty.apns.http2;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.client.api.Request;
import org.eclipse.jetty.client.util.StringContentProvider;
import org.eclipse.jetty.http2.client.HTTP2Client;
import org.eclipse.jetty.http2.client.http.HttpClientTransportOverHTTP2;
import org.eclipse.jetty.util.ssl.SslContextFactory;
# -*- coding: utf-8 -*-
"""
apns-server-http2.py
~~~~~~~~~~~~~~~~~
A simple Python script to mock the Apple push notification gateway (requires Python 3.5).
Usage:
$ python3.5 apns-server-http2.py /path/to/certificate.pem /path/to/key.pem certificate_password port
@judepereira
judepereira / MyApplication.java
Created February 10, 2016 08:18
Setting the CleverTap SDK credentials programmatically in Android
package com.wizrocket.br;
import android.annotation.TargetApi;
import android.os.Build;
import com.clevertap.android.sdk.ActivityLifecycleCallback;
import com.clevertap.android.sdk.CleverTapAPI;
public class MyApplication extends android.app.Application {
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
@Override
@judepereira
judepereira / lessc-idea.sh
Last active February 4, 2016 19:45
A helper to re-compile LESS into CSS for an exploded WAR deployment in IntelliJ IDEA
#!/bin/bash
exploded_artifact_path=/Users/jude/developer/WizRocket/out/artifacts/Dashboard_war_exploded
less=/usr/local/bin/lessc
function update {
target=`echo $1 | sed s/web\\// | sed s/.less/.css/`
echo "Generating $exploded_artifact_path/$target"
$less $1 $exploded_artifact_path/$target