Skip to content

Instantly share code, notes, and snippets.

@djad442
djad442 / dhcp.ps1
Created September 6, 2024 17:23
Powershell Script, Generate Active DHCP Leases
# Define the DHCP Server and the list of Scope IDs (Zones)
$dhcpServer = "MYSERVER" # Replace with the name or IP address of your DHCP server
$scopeIDs = @("10.2.0.0","10.3.0.0","192.168.0.0") # Add all subnets here
# Import the DHCP Server Module (in case it's not loaded)
Import-Module DhcpServer
# Function to convert lease time to Linux format, handling null values
function Convert-LeaseTime($leaseTime) {
if ($leaseTime -ne $null) {
@djad442
djad442 / dhcp-scopes.ps1
Created September 6, 2024 17:19
Powershell Script to extract dhcp config from windows server
# Define the DHCP Server
$dhcpServer = "MYSERVER" # Replace with the name or IP address of your DHCP server
# Import the DHCP Server Module (in case it's not loaded)
Import-Module DhcpServer
# Output file for the Linux-compatible dhcpd.conf
$outputFile = "C:\dhcpd.conf"
# Clear the file if it exists, to avoid appending to old data
@djad442
djad442 / state.dart
Created November 29, 2020 12:55
use of state mixin in getx
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:dio/dio.dart';
void main() {
runApp(GetMaterialApp(
initialRoute: '/home',
getPages: [
GetPage(
name: '/home',
@djad442
djad442 / .dart
Created November 18, 2020 12:30
Flutter Gradient App Bar
class GradientAppBar extends StatelessWidget {
final String title;
final double barHeight = 66.0;
GradientAppBar(this.title);
@override
Widget build(BuildContext context) {
final double statusBarHeight = MediaQuery.of(context).padding.top;
@djad442
djad442 / .dart
Created November 18, 2020 12:19
flutter color to material color
MaterialColor createMaterialColor(Color color) {
List strengths = <double>[.05];
Map swatch = <int, Color>{};
final int r = color.red, g = color.green, b = color.blue;
for (int i = 1; i < 10; i++) {
strengths.add(0.1 * i);
}
strengths.forEach((strength) {
final double ds = 0.5 - strength;
@djad442
djad442 / MKMapViewZoomLevel.cs
Created March 8, 2013 08:36
MonoTouch MKMapView with Zoom Level Property
using System;
using MonoTouch.MapKit;
using MonoTouch.CoreLocation;
using System.Drawing;
using MonoTouch.Foundation;
namespace BinaryQuest
{
[Register("MKMapViewZoomLevel")]
public class MKMapViewZoomLevel : MKMapView