Skip to content

Instantly share code, notes, and snippets.

Tushar Sharma tush4r

Block or report user

Report or block tush4r

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
tush4r /
Created Apr 11, 2017 — forked from kaitoy/
Packet capture with Pcap4J in Java
import org.pcap4j.core.BpfProgram.BpfCompileMode;
import org.pcap4j.core.NotOpenException;
import org.pcap4j.core.PacketListener;
import org.pcap4j.core.PcapHandle;
import org.pcap4j.core.PcapNativeException;
import org.pcap4j.core.PcapNetworkInterface;
import org.pcap4j.core.PcapNetworkInterface.PromiscuousMode;
import org.pcap4j.packet.Packet;
import org.pcap4j.util.NifSelector;
View TimeStampUtility.scala
import org.joda.time.format.DateTimeFormat
import org.joda.time.{DateTime, DateTimeZone}
import scala.util.Try
object TimeStampUtility {
def getCurrentTimeStamp(): Long = {
val timestamp: Long = System.currentTimeMillis / 1000
tush4r / UITextFieldExtension.swift
Created Apr 8, 2016
Returns Int, Float, Double from TextField
View UITextFieldExtension.swift
extension UITextField {
var stringValue : String { return text ?? "" }
var integerValue: Int { return Int(stringValue) ?? 0 }
var doubleValue : Double { return Double(stringValue) ?? 0 }
var floatValue : Float { return Float(stringValue) ?? 0 }
let textField = UITextField()
textField.text.dynamicType // returns an Optional<String>.Type
let optionalIntegerValue = Int(textField.text!) // returns NIL
You can’t perform that action at this time.