Skip to content

Instantly share code, notes, and snippets.

@fchollet
fchollet / classifier_from_little_data_script_3.py
Last active February 26, 2025 01:37
Fine-tuning a Keras model. Updated to the Keras 2.0 API.
'''This script goes along the blog post
"Building powerful image classification models using very little data"
from blog.keras.io.
It uses data that can be downloaded at:
https://www.kaggle.com/c/dogs-vs-cats/data
In our setup, we:
- created a data/ folder
- created train/ and validation/ subfolders inside data/
- created cats/ and dogs/ subfolders inside train/ and validation/
- put the cat pictures index 0-999 in data/train/cats
#!/usr/local/bin/python
from subprocess import call
from subprocess import Popen
from subprocess import PIPE
import re
import winrm
import sys
import time
settings = {
@staaldraad
staaldraad / receivefile.ps1
Created February 24, 2017 16:28
Small powershell script to bind to port, accept connection and stream to file. useful for ```cat blah.exe | nc 192.168.1.7 8080```
$socket = new-object System.Net.Sockets.TcpListener('0.0.0.0', 1080);
if($socket -eq $null){
exit 1;
}
$socket.start();
$client = $socket.AcceptTcpClient();
$stream = $client.GetStream();
$buffer = new-object System.Byte[] 2048;
$file = 'c:/afile.exe';
$fileStream = New-Object System.IO.FileStream($file, [System.IO.FileMode]'Create', [System.IO.FileAccess]'Write');
@JohnLBevan
JohnLBevan / Get-LocalSecurityGroupInfo.ps1
Last active October 4, 2021 18:24
Get Local Security Group Info (PS2 compatible)
#based on code from this blog: https://mcpmag.com/articles/2015/06/18/reporting-on-local-groups.aspx
function Get-AdsiComputer {
[CmdletBinding()]
param (
[Parameter(ValueFromPipeline=$true, ValueFromPipelineByPropertyName=$true)]
[string]$ComputerName = $env:COMPUTERNAME
)
process {
[ADSI]("WinNT://$ComputerName,computer")
@dprice
dprice / Microsoft.PowerShell_profile.ps1
Last active March 18, 2025 14:53
PowerShell Profile #tag PowerShell
$sw = [Diagnostics.Stopwatch]::StartNew()
Write-Host "Updating path..." -foregroundColor DarkGreen
if(!($env:path).contains((Split-Path $PROFILE))) {
$env:path += ";" + (Split-Path $PROFILE)
}
if(!($env:path).contains('D:\dNx\dnx-util;')) {
$env:path += ";" + 'D:\dNx\dnx-util;'
}
if(!($env:path).contains('D:\dNx\dnx-util\test;')) {
$env:path += ";" + 'D:\dNx\dnx-util\test;'
@MMF
MMF / ActiveDirectoryHelper.cs
Last active October 4, 2021 18:19
Authenticate user with Active Directory
using System;
using System.Configuration;
using System.DirectoryServices;
namespace StrategicPlans.Helpers
{
public class ActiveDirectoryHelper
{
public string ActiveDirectoryServerPath { get; set; }
@msghens
msghens / ADconnection.py
Created June 14, 2017 16:26
Snippet for getting group members in AD using python for large memberships
import ldap
class ADconnection(object):
def __enter__(self):
#LDAP Connection
try:
# Fix MS Issues
psExec \\\\WS886 cmd
psExec \\WS886 cmd
psExec '\\WS886' cmd
https://community.spiceworks.com/how_to/78664-remove-local-printer-on-a-remote-machine
function New-ConsoleMenu {
param (
[ScriptBlock]$ScriptBlock,
[String]$Title,
[String]$Prompt,
[Object]$Default,
@indented-automation
indented-automation / Compress-Item.ps1
Last active October 4, 2021 18:19
PowerShell: .NET 4.0 zip file handling
function Compress-Item {
<#
.SYNOPSIS
Compress a file or directory.
.DESCRIPTION
Create a zip file from a collection of files.
.INPUTS
System.IO.FileInfo
.EXAMPLE
Compress-Item .SomeFile.txt