Laser wakefield accelerators have emerged as a promising candidate for compact synchrotron radiation and even x-ray free electron lasers. Today, to make the electrons emit electromagnetic radiation, the trajectories of laser wakefield accelerated electrons are deflected by transverse wakefield, counter-propagating laser field or external permanent magnet insertion device. Here, we propose a novel type of undulator which has a few hundred microns of period and tens of Tesla of magnetic field. The undulator consists of a bifilar capacitor-coil target which sustains strong discharge current that generates helical magnetic field around the coil axis when irradiated by a high energy laser. Coupling this undulator with state-of-the-art laser wakefield accelerators can, simultaneously, produce ultra-bright quasi-monochromatic x-rays with tunable energy ranging 5-250 keV and optimize the free electron laser parameter and gain length compared with permanent magnet based undulator. This concept may pave a path toward ultra-compact synchrotron radiation and even x-ray free electron lasers.