Skip to content

Instantly share code, notes, and snippets.

View prasannavl's full-sized avatar

Prasanna Loganathar prasannavl

View GitHub Profile
@prasannavl
prasannavl / .bash_profile
Created September 9, 2023 14:51 — forked from dylon/.bash_profile
How to get 256 colors in a standard Linux terminal + screen (without X windows).
# ...
# This is for what I would consider a standard setup, where TTY's 1 -- 6 are
# "linux" terminals and TTY's 7+ are reserved for X windows. You should adjust
# it to your setup, accordingly.
#
# ::: Important ::: You must have both fbterm and screen installed and on your
# path for this to work.
virtual_terminal="$( tty | grep -oE ....$ )"
@prasannavl
prasannavl / Set-DisplayOff.ps1
Created September 26, 2015 21:21
Powershell script to turn display off
# Turn display off by calling WindowsAPI.
# SendMessage(HWND_BROADCAST,WM_SYSCOMMAND, SC_MONITORPOWER, POWER_OFF)
# HWND_BROADCAST 0xffff
# WM_SYSCOMMAND 0x0112
# SC_MONITORPOWER 0xf170
# POWER_OFF 0x0002
Add-Type -TypeDefinition '
using System;
@prasannavl
prasannavl / New-FileShortcut.ps1
Last active December 21, 2017 16:54
Create windows shortcuts from Powershell
function New-FileShortcut
{
<#
.SYNOPSIS
Create Windows shortcuts
.DESCRIPTION
Creates shortcuts of the Target in the given location.
Given locations can either be the full path, or just the name in which
case its created on the current path.
If just the target path is given, it creates a shortcut with the same
@prasannavl
prasannavl / sysctl.conf
Last active October 20, 2017 03:29
Linux - Laptop Kernel Config
# Def: 50; Reduce tendency to swap on large RAM system
vm.swappiness=10
# Def: 100; Reduce to retain inode/dentry caches
vm.vfs_cache_pressure=20
# Def: 10; Make it slightly longer to wait longer before writing to HD.
vm.dirty_background_ratio=20
# Def: 20; Make it much larger before starting sync writes
@prasannavl
prasannavl / Set-WindowState.ps1
Created September 26, 2015 21:32
Set a given window state for any window using WinAPI.
function Set-WindowState {
<#
.SYNOPSIS
Set a given window state using WinAPI.
.DESCRIPTION
Use the ShowWindowAsync function to set the Window state for
any given window handle or the current powershell process.
.EXAMPLE
Set-WindowState -State "MINIMIZE"
@prasannavl
prasannavl / Clone-AllGitHubRepos.ps1
Created September 26, 2015 21:26
Clone all the repos for a given GitHub username.
function Clone-AllGitHubRepos
{
<#
.SYNOPSIS
Clone all GitHub Repositories of a given user.
.DESCRIPTION
Recursively clone all the repos for a given username.
.EXAMPLE
Clone-AllGitHubRepos -User "aspnet"
@prasannavl
prasannavl / Update-AutoModuleManifest.ps1
Created September 26, 2015 21:17
Updates a module manifest automatically with all the files in the powershell scripts in the module directory as scripts to process.
function Update-AutoModuleManifest
{
<#
.SYNOPSIS
Updates a module manifest automatically with all the script files
in the module directory as scripts to process.
.DESCRIPTION
Looks for the given module's path, and then uses New-ModuleManifest to
create a manifest file which includes all the "*.ps1" files in the
folder as "ScriptsToProcess".