Skip to content

Instantly share code, notes, and snippets.

View ManojKiranA's full-sized avatar
🔍
Focusing

Manoj Kiran ManojKiranA

🔍
Focusing
  • Postiefs Technologies Private Limited
  • Coimbatore
View GitHub Profile
@johndacosta
johndacosta / get-diskspace.ps1
Created July 25, 2013 14:46
Get Disk Space Information via Powershell in JSON Format
Get-WmiObject win32_volume | Select-Object SystemName,Name, BlockSize, Capacity, FreeSpace, DriveLetter , @{Name="CapacityGB";Expression={[math]::round($_.Capacity/1GB,2)}}, @{Name="FreeSpaceGB";Expression={[math]::round($_.FreeSpace/1GB,2)}} , @{Name="FreeSpacePercent";Expression={[math]::round(($_.FreeSpace/($_.Capacity*1.00))*100.00,2)}} , @{Name="Date";Expression={$(Get-Date -f s)}}| Sort-Object Name | Convertto-JSON
# This format will allow you to filter on drive name and select a remote computer.
# Get-WmiObject win32_volume -ComputerName ServerName | Where-Object {$_.label -match "S\:.*"} | Select-Object SystemName,Name, BlockSize, Capacity, FreeSpace, DriveLetter , @{Name="CapacityGB";Expression={[math]::round($_.Capacity/1GB,2)}}, @{Name="FreeSpaceGB";Expression={[math]::round($_.FreeSpace/1GB,2)}} , @{Name="FreeSpacePercent";Expression={[math]::round(($_.FreeSpace/($_.Capacity*1.00))*100.00,2)}} , @{Name="Date";Expression={$(Get-Date -f s)}}| Sort-Object Name | Convertto-JSON
@raveren
raveren / cryptographically_secure_random_strings.php
Last active November 21, 2023 12:35
Generate cryptographically secure random strings. Based on Kohana's Text::random() method and this answer: http://stackoverflow.com/a/13733588/179104
function random_text( $type = 'alnum', $length = 8 )
{
switch ( $type ) {
case 'alnum':
$pool = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
case 'alpha':
$pool = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
break;
case 'hexdec':
@tsabat
tsabat / supervisor.conf
Created December 28, 2011 15:09
Sample supervisor config file
; Sample supervisor config file.
[unix_http_server]
file=/tmp/supervisor.sock ; (the path to the socket file)
;chmod=0700 ; sockef file mode (default 0700)
;chown=nobody:nogroup ; socket file uid:gid owner
;username=user ; (default is no username (open server))
;password=123 ; (default is no password (open server))
;[inet_http_server] ; inet (TCP) server disabled by default