Skip to content

Instantly share code, notes, and snippets.

View aravindhkumar23's full-sized avatar

aravindhkumar aravindhkumar23

View GitHub Profile
@aravindhkumar23
aravindhkumar23 / ViewController.swift
Created September 27, 2023 12:07
C-based implementation for nw_connection_t and swift implementation for NWConnection [adding it here so that some developers will get help from this.]. Adding to this [(NW_PARAMETERS_DEFAULT_CONFIGURATION, NW_PARAMETERS_DEFAULT_CONFIGURATION)] macros for nw_parameters_create_secure_tcp is not available in swift so we need to create an obj-c brid…
//
// ViewController.swift
// vpn-client
//
// Created by Aravindh Kumar on 9/13/23.
//
import UIKit
import Network
import NetworkExtension
@aravindhkumar23
aravindhkumar23 / DNS_resolver
Created April 4, 2023 13:37
DNS resolver - test implemention - not prod ready
func handlePacket(packetData: Data,syntheticIp: String) {
if(syntheticIp == "" || syntheticIp.isEmpty){
os_log(.default, log: self.log, "*****No synthetic ip found")
return
}
let udpPayload : Data = packetData[28..<packetData.count]
do {
//to deserialize we used https://github.com/Bouke/DNS
let dnsQuery = try Message(deserialize: udpPayload)
@aravindhkumar23
aravindhkumar23 / main.dart
Last active June 9, 2020 16:38
Draw over image and export to png from canvas - flutter
import 'dart:io';
import 'dart:async';
import 'dart:typed_data';
import 'dart:ui' as ui;
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
//import 'package:path_provider/path_provider.dart';
//import 'package:simple_permissions/simple_permissions.dart';
@aravindhkumar23
aravindhkumar23 / main.dart
Created May 3, 2019 13:12
Vertical scroll with alphabet scroll - Flutter
import 'package:flutter/material.dart';
import 'package:draggable_scrollbar/draggable_scrollbar.dart';
import 'package:flutter/foundation.dart';
import 'package:faker/faker.dart';
void main() => runApp(MyApp());
class MyApp extends StatelessWidget {
// This widget is the root of your application.
@override
@aravindhkumar23
aravindhkumar23 / main.dart
Last active January 9, 2024 07:05
Clipping widgets with bezier curves in Flutter
//access the wavy header in body by below code
return Scaffold(
body: Container(height:200.0,child: new WavyHeader()),
);
//creates a curve with 3 curves merged by using stack
// ref link
https://iirokrankka.com/2017/09/04/clipping-widgets-with-bezier-curves-in-flutter/
@aravindhkumar23
aravindhkumar23 / camera_view.dart
Last active March 19, 2021 20:44
Flutter Camera view with + button to open gallery (captured image and gallery picked image will be shown in horizontal scrollable view in bottom like whatsapp)
import 'dart:async';
import 'dart:io';
import 'package:camera/camera.dart';
import 'package:flutter/material.dart';
import 'package:image_picker/image_picker.dart';
import 'package:path_provider/path_provider.dart';
import '/utils.dart';
@aravindhkumar23
aravindhkumar23 / index.ios.js
Last active April 10, 2017 12:38
react-native category subcategory select listview and expand options if exists
/**
* Sample React Native App
* https://github.com/facebook/react-native
* @flow
*/
import React, { Component } from 'react';
import {
AppRegistry,
StyleSheet,
@aravindhkumar23
aravindhkumar23 / swipeViewController.swift
Last active November 29, 2016 08:58
carousel view programatically swift includes [collection view, pageControl, with 2 button and 3 labels] swift 2.3
// Swift 2.3 Xcode 7.3.1
import UIKit
class swipeViewController: UIViewController, UICollectionViewDelegateFlowLayout, UICollectionViewDataSource {
let fontName: String = "Aileron-Regular"
let fontSize: CGFloat = 16
var collectionView: UICollectionView!
let layout: UICollectionViewFlowLayout = UICollectionViewFlowLayout()
@aravindhkumar23
aravindhkumar23 / findMatch
Created October 20, 2016 13:44
sort dictionary inside array, and find match between 2 array
let loggedIn_array = ((loggedInUserSolution.valueForKey("solutions") as? NSArray ?? NSArray()).sort{
(($0 as? Dictionary<String, String> ?? Dictionary<String, String>())["solution_id"]) < (($1 as? Dictionary<String, String> ?? Dictionary<String, String>())["solution_id"])
}) as NSArray
let opposite_array = ((oppositeUserSolution.valueForKey("solutions") as? NSArray ?? NSArray()).sort{
(($0 as? Dictionary<String, String> ?? Dictionary<String, String>())["solution_id"]) < (($1 as? Dictionary<String, String> ?? Dictionary<String, String>())["solution_id"])
}) as NSArray
print("loggedIn_array ::\(loggedIn_array)")
print("opposite_array ::\(opposite_array)")
@aravindhkumar23
aravindhkumar23 / sort.txt
Created October 18, 2016 11:13
Sorting Array of dictionary with key(Int) eg:[{"name":"value","time":"time"},{}]
sortedarray = storedarray.sort{
(($0 as! Dictionary<String, AnyObject>)["time"] as? Int) < (($1 as! Dictionary<String, AnyObject>)["time"] as? Int)
}