Skip to content

Instantly share code, notes, and snippets.

View NimzyMaina's full-sized avatar

Nimrod Maina NimzyMaina

View GitHub Profile
@HBiSoft
HBiSoft / FileUtils.java
Last active February 1, 2024 19:10
This fixes the issue when selecting a file from Downloads directory as well as the SD Card. This class can be called like this: String sourcePath = FileUtils.getRealPathFromURI_API19(this, data.getData());
import android.annotation.SuppressLint;
import android.content.ContentUris;
import android.content.Context;
import android.content.CursorLoader;
import android.database.Cursor;
import android.net.Uri;
import android.os.Build;
import android.os.Environment;
import android.provider.DocumentsContract;
import android.provider.MediaStore;
@staakk
staakk / NetModule.java
Created November 23, 2017 13:44
Dagger2 module for Retrofit with authorization, and Java 8 DateTime mappers
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.module.SimpleModule;
import org.threeten.bp.LocalDateTime;
import javax.inject.Singleton;
import dagger.Module;
import dagger.Provides;
import okhttp3.OkHttpClient;
@andykuszyk
andykuszyk / Setting up Cassandra for remote access.md
Last active October 31, 2023 07:48
Setting up Cassandra for remote access

Make these changes in the cassandra.yaml config file:

start_rpc: true

rpc_address: 0.0.0.0

broadcast_rpc_address: [node-ip]

listen_address: [node-ip]

@luisdeol
luisdeol / DataExportClass.cs
Last active May 6, 2024 09:29
Export List of Objects to a Comma-Separated Values (.CSV) file using C#, allowing the export of Entity Framework DbSet to CSV File. An example of use comes within the code.
using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace DataExportClass
{
class Program
{
public class Employee
@dunkelstern
dunkelstern / ipsec.conf
Created August 7, 2016 19:00
StrongSWAN ipsec config for IKEv2 VPN
# ipsec.conf - strongSwan IPsec configuration file
config setup
charondebug="ike 4, knl 4, cfg 4, net 4, esp 4, dmn 4, mgr 4"
conn %default
keyexchange=ike
ike=aes128-sha1-modp1024,aes128-sha1-modp1536,aes128-sha1-modp2048,aes128-sha256-ecp256,aes128-sha256-modp1024,aes128-sha256-modp1536,aes128-sha256-modp2048,aes256-aes128-sha256-sha1-modp2048-modp4096-modp1024,aes256-sha1-modp1024,aes256-sha256-modp1024,aes256-sha256-modp1536,aes256-sha256-modp2048,aes256-sha256-modp4096,aes256-sha384-ecp384,aes256-sha384-modp1024,aes256-sha384-modp1536,aes256-sha384-modp2048,aes256-sha384-modp4096,aes256gcm16-aes256gcm12-aes128gcm16-aes128gcm12-sha256-sha1-modp2048-modp4096-modp1024,3des-sha1-modp1024!
esp=aes128-aes256-sha1-sha256-modp2048-modp4096-modp1024,aes128-sha1,aes128-sha1-modp1024,aes128-sha1-modp1536,aes128-sha1-modp2048,aes128-sha256,aes128-sha256-ecp256,aes128-sha256-modp1024,aes128-sha256-modp1536,aes128-sha256-modp2048,aes128gcm12-aes128gcm16-aes256gcm12-aes256gcm16-modp2048-modp4096-modp
@jdnichollsc
jdnichollsc / main.js
Created January 17, 2016 19:59
Cordova - Send base64 file with jsPDF and Email Composer
var pdfString = doc.output('datauristring'); //base64 string from jsPDF
if (window.cordova && window.cordova.plugins.email) {
var email = {
//to: 'jdnichollsc@hotmail.com',
//cc: 'jdnichollsc@hotmail.com',
//bcc: ['jdnichollsc@hotmail.com'],
attachments: [
generateAttachment(pdfString, "myFileName.pdf")