Skip to content

Keycode

More flesh, less fluff.

Month: May 2020

Delete files owned by a specific user on Linux

Delete all txt files:

find ~/testFolder/*.txt -user @USERNAME -exec rm {} \;

Note, the semicolon is necessary.

Delte all files and directories:

find ~/testFolder/ -user @USERNAME -exec rm -rf {} \;

But be careful using “-rf”.

Author pashanhuPosted on 24/05/2020Categories LinuxTags find, rm, userLeave a comment on Delete files owned by a specific user on Linux

Git push a cloned repository to a new remote repository

git remote rename origin upstream
git remote add origin NEW_REMOTE_REPOSITORY
git push origin master
Author pashanhuPosted on 17/05/2020Categories gitTags rename upstreamLeave a comment on Git push a cloned repository to a new remote repository

struct vs. class in Swift

structclass
Value typeReference type
Cannot inherit or be inheritedHas inheritance
On the StackOn the heap
Faster Slower
No memory leaksPotential memory leaks
Deep copies
True immutability
Threadsafe
Works with Objective-C code
Struct vs. Class

Use struct as much as possible.

I guess Swift learns this from C#.

Java doesn’t have struct keyword.

Author pashanhuPosted on 17/05/2020Categories SwiftTags class, structLeave a comment on struct vs. class in Swift

Recent Posts

  • Traits and Template Partial Specialisation – 2
  • Traits and Template Partial Specialisation – 1
  • Assert exception during python unit test
  • Resize VirtualBox hard disk capacity
  • Solution to “Another app is currently holding the yum lock; waiting for it to exit”

Recent Comments

No comments to show.
  • September 2022
  • July 2022
  • June 2022
  • April 2022
  • August 2021
  • November 2020
  • October 2020
  • June 2020
  • May 2020
  • February 2020
  • October 2019
  • September 2019
  • August 2019
  • Algorithm
  • Boost
  • C/C++
  • Debug
  • git
  • GitHub
  • Image/Graphics
  • Java
  • Linux
  • Node.js
  • Other
  • Python
  • Qt
  • Swift
Keycode Proudly powered by WordPress