Skip to content

Instantly share code, notes, and snippets.

@alex2600
alex2600 / markdown-details-collapsible.md
Created December 7, 2021 09:43 — forked from pierrejoubert73/markdown-details-collapsible.md
How to add a collapsible section in markdown.

A collapsible section containing markdown

Click to expand!

Heading

  1. A numbered
  2. list
    • With some
    • Sub bullets
@alex2600
alex2600 / git-tag-delete-local-and-remote.sh
Created October 16, 2019 17:41 — forked from mobilemind/git-tag-delete-local-and-remote.sh
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@alex2600
alex2600 / TtlCounter.js
Created June 17, 2019 17:05
Simple Counter Class using a ttl for counts
class TtlCounter {
constructor (ttl) {
this._count = 0
this._ttl = ttl
}
get value () {
return this._count
}
@alex2600
alex2600 / gulpfile.js
Last active May 9, 2019 19:00
Wrapper function for gulp stream pipelines using highland.js (usage here: wrap markdown html output into a handlebars template)
const h = require("highland")
const handlebars = require("handlebars")
// handlebars wrapper pipeline for gulp object stream
const wrapIt = h.pipeline(function (stream) {
return h(stream) // wrap node stream into a highland stream
// .tap(vinylObject => console.log(vinylObject.path))
.map(function (vinylObject) {
const data = vinylObject.contents.toString() // convert marktdown html to string
const tpl = fs.readFileSync(tplFile, "utf8") // read handlebars template
@alex2600
alex2600 / sortJson.js
Last active October 5, 2018 12:19
Sort object keys in JSON file
#!/usr/bin/env node
/////// SORT OBJECT KEYS OF JSON FILE ////////////////////////////////////////////////////////////////
// TODO make recursive for object with depth > 1
/////////////////////////////////////////////////////////////////////////
const fs = require("fs")
const options = "utf8"
const file = process.argv[2]
@alex2600
alex2600 / ediff.py
Last active October 5, 2018 11:56 — forked from bamanzi/ediff.py
[emacs] ediff command line launcher
#!/usr/bin/python
# diff and merge two files using emacs ediff-mode
import os
import os.path
import sys
if len(sys.argv)<3:
sys.stderr.write("Usage: ediff file1 file2")
else:
@alex2600
alex2600 / gist:3b2ebd16fa5b088358eda7597f1be196
Last active September 19, 2024 10:56
Create virtual device from file and use it in LVM
fallocate -l 256M /image.img # create file to store a filesystem
losetup /dev/loop0 # check if loop0 is free to use, if not continue with loop1, ...
losetup /dev/loop0 /image.img # create device using file
pvcreate /dev/loop0 # create lvm physical volume
vgcreate lvmstorage /dev/loop0 # create volume group "lvmstorage" using device
lvcreate -L 128M -n lv1 lvmstorage # create logical volume "lv1" with size 128M
mkfs.ext4 /dev/lvmstorage/lv1 # create file system
e2label /dev/lvmstorage/lv1 LV1 # set label "LV1" for device
mkdir /mnt/stuff
mount /dev/lvmstorage/lv1 /mnt/stuff # mount device