Skip to content

Instantly share code, notes, and snippets.

View pnsinha's full-sized avatar

P. Sinha pnsinha

View GitHub Profile
#download the latest proj.4 package
wget http://download.osgeo.org/proj/proj-5.0.0RC2.zip
unzip -o -q proj-5.0.0RC2.zip -d ./
cd proj-5.0.0
./configure --prefix=/scratch/home/p0sinh02/packages/proj/
make
make install
#download the latest GDAL package
wget http://download.osgeo.org/gdal/CURRENT/gdal-2.2.3.tar.gz
@pnsinha
pnsinha / disk usages
Created March 26, 2021 18:50
linux management
du -sh dir
du -h --max-depth=1
du -h --max-depth=1 | sort -n
@pnsinha
pnsinha / R
Created April 20, 2021 18:10
pointpattern
ggplot() +
geom_point(data = PointPatterns, aes(x = x, y = y)) + facet_grid(.~ Pattern) +
coord_fixed()
@pnsinha
pnsinha / r_objects.r
Created May 17, 2021 18:44
r objects in memory #r
sort( sapply(ls(),function(x){object.size(get(x))}))
# improved list of objects
.ls.objects <- function (pos = 1, pattern, order.by,
decreasing=FALSE, head=FALSE, n=5) {
napply <- function(names, fn) sapply(names, function(x)
fn(get(x, pos = pos)))
names <- ls(pos = pos, pattern = pattern)
obj.class <- napply(names, function(x) as.character(class(x))[1])
obj.mode <- napply(names, mode)
@pnsinha
pnsinha / choco commands
Created March 18, 2022 15:19
Command list for chocolatey
[Chocolatey Command Reference](https://chocolatey.org/docs/commands-reference) for a complete list.
## Examples
| Command | Description |
| ---------------------------------------------- | ------------------------------------------------ |
| **Find a package** | |
| `choco list` | List all chocolatey packages |
| `choco search zip` | Search packages mentionning "zip" |
@pnsinha
pnsinha / chocoscoop.ps1
Created March 24, 2022 06:04 — forked from dominicusin/chocoscoop.ps1
install scoop & choco
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
$env:SCOOP='D:\prg\scoop'
[environment]::setEnvironmentVariable('SCOOP',$env:SCOOP,'User')
$env:SCOOP_GLOBAL='D:\prg\sapps'
[environment]::setEnvironmentVariable('SCOOP_GLOBAL',$env:SCOOP_GLOBAL,'Machine')
iwr -useb get.scoop.sh | iex
Set-ItemProperty 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1
scoop install 7zip innounp dark wixtoolset sudo curl git
#sudo
@pnsinha
pnsinha / Vim.md
Last active December 19, 2022 07:51
[Vim Cheatsheet] #vim

https://github.com/hackjutsu/vim-cheatsheet

Vim Cheatsheet

Disclaimer: This cheatsheet is summarized from personal experience and other online tutorials. It should not be considered as an official advice.

Global

:help keyword # open help for keyword
:o file       # open file
:saveas file  # save file as
@pnsinha
pnsinha / lxc-create.sh
Created May 30, 2022 11:47 — forked from gigadot/lxc-create.sh
Create LXC and Bridge with LAN interface
#/bin/bash
# Check if bridge-nf-call-iptables is enabled (1 if enabled)
# cat /proc/sys/net/bridge/bridge-nf-call-iptables
# Enable IP Forwarding
# echo 'net.ipv4.ip_forward=1' >> /etc/sysctl.conf
# sysctl --system
CONTAINER_NAME=kube
BRIDGED_NAME=br0
@pnsinha
pnsinha / installs.ps1
Created June 16, 2022 05:20 — forked from jimbrig/installs.ps1
Scoop Configuration and Installation for R
# check execution policy
If ((Get-ExecutionPolicy) -eq 'Restricted') {
Set-ExecutionPolicy Unrestricted -Scope CurrentUser
}
# check powershell $PROFILE
If (!(Test-Path $PROFILE)) {
Write-Host "No PowerShell $PROFILE detected, creating one.." -ForegroundColor Magenta
New-Item -ItemType File -Path $PROFILE -Force
Write-Host "Created PowerShell Profile at: $PROFILE" -ForegroundColor Green
cd /etc/resolvconf/resolv.conf.d
sudo cp -p head head.orig #backup copy, always do this
#sudo nano head
#nameserver <ip_of_nameserver>
echo "nameserver 8.8.8.8" | sudo tee -a head
#regenerate resolvconf
sudo resolvconf -u