ip
– from Iproute2, a collection of utilities for controlling TCP/IP networking and traffic control in Linux.ls
– list directory contents.df
– display disk space usage.du
– estimate file space usage.free
– display memory usage.scp
– securely Copy Files Using SCP, with examples.find
– locates files based on some user-specified criteria.ncdu
– a disk utility for Unix systems.pstree
– display a tree of processes.last
– show a listing of last logged in users.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ref: https://stackoverflow.com/a/538238/3367974 | |
public class Foo : IDisposable | |
{ | |
protected void Dispose(Boolean disposing) | |
{ | |
// free unmanaged resources | |
if (disposing) | |
{ | |
// free managed resources |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// based on js version -> https://gist.github.com/dehghani-mehdi/df7f216d8031abad8c911b8117b7000e | |
public bool IsValidNationalCode(string value) | |
{ | |
// extract only numbers form the value | |
value = new string(value?.Where(char.IsDigit).ToArray()); | |
if (value.Length != 10 || Regex.IsMatch(value, @"(\d)(\1){9}")) return false; | |
var sum = 0; | |
var chars = value.ToCharArray(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[buildPlans.iosevka-custom] | |
family = "Iosevka Custom" | |
spacing = "term" | |
serifs = "sans" | |
no-cv-ss = true | |
[buildPlans.iosevka-custom.variants] | |
inherits = "ss10" | |
[buildPlans.iosevka-custom.variants.design] |
- Pull (Update repo):
git pull
- Commit:
git add .
git commit -m "COMMIT COMMENT"
- Short version:
git commit -am "COMMIT COMMENT"
- Push (Update remote):
git push <remote-name> <branch-name>
- Clone:
git clone <url>
- Clone a branch:
git clone <url> BRANCH_NAME
- Clone and create a branch:
git clone <url> -b BRANCH_NAME
- Get repo's remote URL:
git config --get remote.origin.url
C#
public decimal GetDiscountPercentage(decimal sellPrice, decimal discountPrice)
=> sellPrice == 0 ? 0 : Math.Abs((((discountPrice - sellPrice) / sellPrice) * 100));
public decimal GetDiscountPrice(decimal sellPrice, byte discountPercentage)
=> discountPercentage == 0 ? 0 : sellPrice == 0 ? 0 : sellPrice - (sellPrice * discountPercentage / 100);
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// C# version -> https://gist.github.com/dehghani-mehdi/2af3d913786d8b1b286f9c28cc75d5f4 | |
var isValidNationalCode = function(code) { | |
if (code.length !== 10 || /(\d)(\1){9}/.test(code)) return false; | |
var sum = 0, | |
chars = code.split(''), | |
lastDigit, | |
remainder; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public string Slugify(string s) | |
{ | |
if (string.IsNullOrWhiteSpace(s)) return ""; | |
// removing extra spaces and keeping just one | |
s = string.Join(" ", Regex.Split(s, @"\s+")).ToLower(); | |
var specialPhases = new Dictionary<string, string> | |
{ | |
{"c#","c-sharp"}, |
- Head to
C:\Users\%USERNAME%\AppData\Roaming\Mozilla\Firefox\Profiles\
- Copy/Backup the directory in some place safe
Do you have multiple directories? that means you have multiple Firefox's profiles, in most cases xxxxxxxx..default is the main one (if you have multiple Firefox's profiles, you are pro user, what the hell you doing here?!)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// First you need to put .ttf of the font to Assets folder | |
// Let's say the font file name is: MyFont.ttf | |
// create typeface | |
var typeface = Typeface.CreateFromAsset(Assets, "MyFont.ttf"); | |
// find the TextView | |
var tvTitle = FindViewById<TextView>(Resource.Id.tvTitle); | |
// assign the typeface to the TextView |
NewerOlder