Skip to content

Instantly share code, notes, and snippets.

@zenius
zenius / product-key-windows
Created October 4, 2020 12:28
Find the Windows 10 Product Key on a New Computer
1. Press Windows key + X.
2. Click Command Prompt (Admin)
3. At the command prompt, type:
wmic path SoftwareLicensingService get OA3xOriginalProductKey
This will reveal the product key. Volume License Product Key Activation.
Disclaimer:
It will reveal the key if the windows you have installed is genuine.
@zenius
zenius / modify-latest-commit-message
Created September 29, 2020 01:56
modifying the latest commit message in github
1. On the command line, navigate to the repository that contains the commit you want to amend.
2. Type git commit --amend and press Enter.
3. In your text editor, edit the commit message and save the commit.
@zenius
zenius / installing-sublime-text-in-debian
Created September 18, 2020 13:38
installation guide for sublime text in debian 10
# Add Sublime Text repository signing key to verify downloaded packages:
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
# For stable releases of Sublime Text:
echo "deb https://download.sublimetext.com/ apt/stable/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
# For Unreleased, development versions:
echo "deb https://download.sublimetext.com/ apt/dev/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
# Ensure that apt can handle HTTPS sources:
@zenius
zenius / caesars-cipher-rot13
Last active September 15, 2020 12:22
freecodecamp Caesars Cipher Project Solution
//'A'.charCodeAt() === 65
// 'N'.charCodeAt() === 78
#Solution No.1
function rot13(str) {
let result = '';
for(let i = 0; i < str.length; i++) {
let char = str[i];
if(/[A-Z]/.test(char)) {
let value = char.charCodeAt();
@zenius
zenius / currying-challenge
Created September 6, 2020 12:53
Intermediate Algorithm Scripting: Arguments Optional
Create a function that sums two arguments together.
If only one argument is provided, then return a function that expects one argument and returns the sum.
For example, addTogether(2, 3) should return 5, and addTogether(2) should return a function.
Calling this returned function with a single argument will then return the sum:
var sumTwoAnd = addTogether(2);
sumTwoAnd(3) returns 5.
If either argument isn't a valid number, return undefined.
Solution:
@zenius
zenius / installing-node-in-debian
Created August 17, 2020 04:53
installation and removal guide of git in debian 10
Steps:
1. update the apt package
sudo apt update
2. install the git package
sudo apt install git
3. Check if it is properly installed,
git --version
output:
git version <you will get your git version here>
@zenius
zenius / installing-node-in-debian
Last active August 17, 2020 04:54
installation and removal guide of nodejs in debian
Steps:
1. update the apt package
sudo apt update
2. install node and npm package
sudo apt install nodejs npm
3. To check if node is properly installed,
node --version
output:
<you will get your node version here>
@zenius
zenius / fritzing installation in debian.md
Last active August 14, 2020 09:33
Installation guide to fritzing in debian

Step 1: First update and upgrade the debian packages

sudo apt update && sudo apt upgrade

Step 2: Install all the necessary packages for fritzing

sudo apt install fritzing fritzing-data fritzing-parts
Fritzing is an open-source initiative to develop amateur or 
hobby CAD software for the design of electronics hardware, 
to support designers and artists ready to move from experimenting 
Usernames are used everywhere on the internet.
They are what give users a unique identity on their favorite sites.
You need to check all the usernames in a database.
Here are some simple rules that users have to follow when creating their username.
1) Usernames can only use alpha-numeric characters.
2) The only numbers in the username have to be at the end.
There can be zero or more of them at the end. Username cannot start with the number.
#Decompress String
You are given a string S. You to have to first sort the characters in the string.
Now, Suppose a character 'c' occurs x times in the modified string.
Replace these consecutive occurrences of the character 'c' with (x, c) in the string.
Itertools.groupby() will help you in achieving it.
Input Format
First line will contain a string s.
Constraints