Skip to content

Instantly share code, notes, and snippets.

@naporium
naporium / delete_git_submodule.md
Created June 20, 2023 16:20 — forked from myusuf3/delete_git_submodule.md
How effectively delete a git submodule.

To remove a submodule you need to:

  • Delete the relevant section from the .gitmodules file.
  • Stage the .gitmodules changes git add .gitmodules
  • Delete the relevant section from .git/config.
  • Run git rm --cached path_to_submodule (no trailing slash).
  • Run rm -rf .git/modules/path_to_submodule (no trailing slash).
  • Commit git commit -m "Removed submodule "
  • Delete the now untracked submodule files rm -rf path_to_submodule
@naporium
naporium / 0-intro.md
Created October 30, 2022 07:52 — forked from leecade/0-intro.md
Raspberry PI 3 cheat sheet
@naporium
naporium / arduinolib.md
Created October 30, 2022 07:50 — forked from spacehuhn/arduinolib.md
Arduino Library Cheat Sheet

Arduino Library Cheat Sheet

Create the library

  • Make a GitHub repository for it
  • The library name should not start with Arduino
  • Make enough examples with good comments
  • Write an extensive README.md that explains how to install and use the library
  • Should be useful for all architectures, otherwise think twice if your library should be published to the library manager

Define version

@naporium
naporium / Simple Calculator
Created October 30, 2022 07:45 — forked from dan49075/Simple Calculator
Simple calculator made in C
//Calculator program
#include <stdio.h>
#include <stdlib.h>
int main()
{
int menu; //Variable for the number the user inputs
float num1, num2, result; //Float variables for the user input and output, used floats in case the user enters e.g. 14.7
printf("Enter a number from the list below\n\n");
@naporium
naporium / hello1.c
Created October 30, 2022 07:42 — forked from ramsey/hello1.c
Hello, World in C
#include <stdio.h>
int main()
{
printf("hello, world\n");
}
// Compile, then run `./a.out 1>stdout.txt 2>stderr.txt`
// Then run `echo $?`
// stdout.txt should contain "hello, world"
@naporium
naporium / powershell cheat sheet
Created October 30, 2022 07:29 — forked from githubfoam/powershell cheat sheet
powershell cheat sheet
==========================================================================================================
#powershell editor in windows
PowerShell ISE,Visual Studio Code,Notepad++
==========================================================================================================
#update / upgrade powershell
> $PSVersionTable.PSVersion
Major Minor Patch PreReleaseLabel BuildLabel
----- ----- ----- --------------- ----------
@naporium
naporium / cheatsheet.ps1
Created October 30, 2022 07:28 — forked from pcgeek86/cheatsheet.ps1
PowerShell Cheat Sheet / Quick Reference
Get-Command # Retrieves a list of all the commands available to PowerShell
# (native binaries in $env:PATH + cmdlets / functions from PowerShell modules)
Get-Command -Module Microsoft* # Retrieves a list of all the PowerShell commands exported from modules named Microsoft*
Get-Command -Name *item # Retrieves a list of all commands (native binaries + PowerShell commands) ending in "item"
Get-Help # Get all help topics
Get-Help -Name about_Variables # Get help for a specific about_* topic (aka. man page)
Get-Help -Name Get-Command # Get help for a specific PowerShell function
Get-Help -Name Get-Command -Parameter Module # Get help for a specific parameter on a specific command
@naporium
naporium / README.md
Created October 30, 2022 07:18 — forked from hofmannsven/README.md
Git Cheatsheet
@naporium
naporium / pandas_cheat_sheet.md
Created October 30, 2022 07:16 — forked from luis-perez-one/pandas_cheat_sheet.md
Pandas cheat sheet: common code for Data Analysis

Pandas Cheat Sheet

This is a collection of common pandas code used while performing Data Analysis

import pandas as pd
import numpy as np

Handling csv files

  • Create a DataFrame from a csv file
@naporium
naporium / argparse_snippets.py
Created October 30, 2022 07:11 — forked from fomightez/argparse_snippets.py
useful argparse snippets
# from `get_seq_following_seq_from_FASTA.py`
if __name__ == "__main__" and '__file__' in globals():
""" This is executed when run from the command line """
# Code with just `if __name__ == "__main__":` alone will be run if pasted
# into a notebook. The addition of ` and '__file__' in globals()` is based
# on https://stackoverflow.com/a/22923872/8508004
# See also https://stackoverflow.com/a/22424821/8508004 for an option to
# provide arguments when prototyping a full script in the notebook.
###-----------------for parsing command line arguments-------------------###
import argparse