Skip to content

Instantly share code, notes, and snippets.

View yudanta's full-sized avatar

Yudanta yudanta

View GitHub Profile
@yudanta
yudanta / mpi_integral.c
Created December 16, 2013 02:01
example
/* Program ini membandingkan estimasi trapezoidal rule integral dari F(x)= exp (x)
Program ini memerlukan panggilan berikut :
-MPI_Init
-MPI_Comm_rank
-MPI_Comm_size
-MPI_Finalize
Program Membutuhkan Input:
@yudanta
yudanta / mpi_pararel.c
Created December 16, 2013 02:23
compiling : $ mpicc parallel_integral.c -o pararel testing : $ ./pararel 1 2 3
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <sys/time.h>
#include <mpi.h>
double f(double a){
return (a*exp(2*a));
//return a;
}
// Author: Wes Kendall
// Copyright 2011 www.mpitutorial.com
// This code is provided freely with the tutorials on mpitutorial.com. Feel
// free to modify it for your own use. Any distribution of the code must
// either provide a link to www.mpitutorial.com or keep this header in tact.
//
// An intro MPI hello world program that uses MPI_Init, MPI_Comm_size,
// MPI_Comm_rank, MPI_Finalize, and MPI_Get_processor_name.
//
#include <mpi.h>
@yudanta
yudanta / gitlab_webhook_post_receive.php
Last active January 3, 2016 22:09
simple php script to handle gitlab webhook post data
<?php
try {
if ($HTTP_RAW_POST_DATA)
{
if ($git_hook_data = json_decode($HTTP_RAW_POST_DATA))
{
$fn = fopen('hook.log.txt', 'w') or die('cant open file');
fwrite($fn, "hook data received at: ".date('Y-m-d H:i:s')."\n");
fwrite($fn, print_r($git_hook_data, true));
@yudanta
yudanta / soundclouddl
Last active August 29, 2015 13:58
soundcloud downloader
#!/usr/bin/env python
#usage : python soundclouddl.py <soundcloud url track/list>
import soundcloud
import urllib
import re
import time
import os
import sys
@yudanta
yudanta / gist:c42da21b089692e31c92
Created August 3, 2014 12:34
prevent ascii error
#prevent ascii error
#place at the top of the file :D
import codecs
import sys
streamWriter = codecs.lookup('utf-8')[-1]
sys.stdout = streamWriter(sys.stdout)
@yudanta
yudanta / gist:6ecd7ac0388d8ea77769
Created August 4, 2014 12:23
sample post to gcm
<?php
$apiKey = "api_key";
$messageData = array(
"code" => 1001,
"subject" => "hai kak zam",
"messages" => "hai kak zam",
);
$registrationIdsArray = array("gcm_id");
@yudanta
yudanta / gist:a74fda922be59253337d
Created August 18, 2014 09:38
Python GCM Sample
#!/usr/bin/env python
import requests
import json
GCM_URL = "https://android.googleapis.com/gcm/send"
API_KEY = "your api key"
CLIENT_GCM = ["your device gcm_id"]
<?php
$url = "https://android.googleapis.com/gcm/send";
$api_key = "<api key>";
$client_id = array("gcm_id");
$headers = array(
"Content-type: application/json",
"Authorization: key=" . $api_key,
#!/usr/bin/env python
# how to use just create instance from this class, you can set client id or client secret from constructor
# Methods
# 1. get token get_token() //getting token key
# 2. check_token(token) // for checking tokon is valid or not
# 3. sending_sms(number, message, token, *args, **kwargs) //sending message => return message id
# 4. check_status_message(message_id, token, *args, **kwargs) //check status message
#