Skip to content

Instantly share code, notes, and snippets.

View ram0973's full-sized avatar
:octocat:
Thinking

ram0973 ram0973

:octocat:
Thinking
View GitHub Profile
@ram0973
ram0973 / Fibonacci_in_Powershell.ps1
Last active October 1, 2018 17:22
Fibonacci in Powershell
Function Fib($n) {
if ($n -lt 2) {
return $n
}
return (Fib($n - 2)) + (Fib($n - 1))
}
1..30 | ForEach-Object {Fib -n $_}
@ram0973
ram0973 / Fibonacci_in_python.py
Created October 1, 2018 17:39
Fibonacci in python
def fib(n):
if n < 2:
return n
return fib(n - 2) + fib(n - 1)
for i in range(1,30):
print(fib(i))
/**
* NeoPixel HSL
*
* Author: E. Scott Eastman
* Date: Feb 2017
*
* Add HSL to RGB Color space conversion. Originially designed to
* work with the Adafruit NeoPixel Library
*
* MIT License
@ram0973
ram0973 / gist:540c5e05d158be6be71f8d2d7b7a8f40
Created February 4, 2019 13:30
Remove unused/hanged containers/images/nwetworks
# docker system prune
WARNING! This will remove:
- all stopped containers
- all networks not used by at least one container
- all dangling images
- all dangling build cache
echo "nameserver 8.8.8.8" | sudo tee /etc/resolv.conf > /dev/null
@ram0973
ram0973 / gist:005936957c80422ba7cfa877a30de406
Created April 9, 2019 13:11
Forget to set name and email in git
git config --global --edit
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author
@ram0973
ram0973 / wsl.ps1
Last active April 12, 2019 16:10
WSL setup in powershell
Invoke-WebRequest -Uri https://aka.ms/wsl-ubuntu-1804 -OutFile Ubuntu.appx -UseBasicParsing
Add-AppxPackage .\Ubuntu.appx
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux
# restart Windows
ubuntu1804
@ram0973
ram0973 / show last 5 numbers of Office 2016 key.ps1
Created April 15, 2019 14:08
Show last 5 numbers of Office 2016 key
cd "C:\Program Files (x86)\Microsoft Office\Office16"
cscript ospp.vbs /dstatus
@ram0973
ram0973 / gist:9176e3b5a9fe94628017ad6d68b99dcc
Created April 18, 2019 10:33
Linux directories pretty yellow color in bash
export LS_COLORS="$LS_COLORS:di=1;33"
@ram0973
ram0973 / gist:8a1e0cdedcc9d86e18b3b81a741c76e9
Last active April 19, 2019 06:48
Another colored bash prompt
export PS1="SH \[\033[38;5;14m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\]@\[$(tput sgr0)\]\[\033[38;5;11m\]\h\[$(tput sgr0)\]\[\033[38;5;15m\]:\[$(tput sgr0)\]\[\033[38;5;13m\]\w\[$(tput sgr0)\]\[\033[38;5;15m\]{\$?}\\$ \[$(tput sgr0)\]"