Skip to content

Instantly share code, notes, and snippets.

View darknessnerd's full-sized avatar
👽

Brunino Criniti darknessnerd

👽
  • Konica Minolta Global R&D
  • Rome
View GitHub Profile
# Rename the local branch to the new name
git branch -m <old_name> <new_name>
# Delete the old branch on remote - where <remote> is, for example, origin
git push <remote> --delete <old_name>
# Or shorter way to delete remote branch [:]
git push <remote> :<old_name>
# Prevent git from using the old name when pushing in the next step.
@darknessnerd
darknessnerd / gist:305b08c871119d40d5a8dfc2bb8e8658
Created November 16, 2023 14:54
How to format and mount a disk permanently using its's UUID.
Find the disk name
sudo lsblk
This will show you a list of disks. Usually the first disk is vda and bootable. The second disk will be vdb, third vdc etc.
vda will typically be split in to multiple partitions, e.g. vda1 (/boot) and vda2 (/).
The new disk will have no partitions and no mountpoint.
Format the new disk
sudo mkfs.ext4 /dev/vdX
@darknessnerd
darknessnerd / uuidv4.js
Created March 16, 2021 09:22
uuidv4 generator
function uuidv4() {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
@darknessnerd
darknessnerd / uuidv4.js
Created March 16, 2021 09:17
UUID V4 Random generator
const uuidv4 = () => ([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, (c) => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16));
console.log(uuidv4());
@darknessnerd
darknessnerd / index,js
Created October 1, 2020 08:53
Build a JWT With a Private Key
const njwt = require('njwt');
const privateKey=`
-----BEGIN PRIVATE KEY-----
...
...
-----END PRIVATE KEY-----
`
const clientId = "test"; // Or load from configuration
const now = Math.floor( new Date().getTime() / 1000 ); // seconds since epoch
@darknessnerd
darknessnerd / media-query.css
Last active August 24, 2020 08:40
CSS Media Queries for Desktop, Tablet, Mobile.
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
//CSS
}