Skip to content

Instantly share code, notes, and snippets.

@windli2018
windli2018 / shrink xfs filesystem on lvm.md
Last active May 17, 2024 02:13
shrink xfs filesystem

According to https://xfs.org/index.php/Shrinking_Support :
"Currently XFS Filesystems can't be shrunk."
You need backup the data and recreate the file system to shrink it.
But if you have a big xfs filesystem with not too much space used, For example, a 2T xfs volume with 100G data.
And you can take some risk to lose data. Here is a way to shrink it without using new space.
The idea is:
1.temporary reduce the logic volume size, you can still read from xfs filesystem even after the partition or volume is shrunk if the real data is not wrote at the shrunk part
2.create a new volume
3.copy data

@lholhox
lholhox / rmslink.php
Created November 22, 2012 18:17
Rumus Luas Dan Keliling Lingkaran
@microbial
microbial / is_absolute_path.js
Last active May 17, 2024 02:12
isAbsolutePath
//Refactor of absolute path check from Express
module.exports = function (path){
var pathIsAbsolute = false,
firstCharIsSlash = path[0] === '/',
containsWinChars = path[1] === ':' && path[2] === '\\';
if(firstCharIsSlash || containsWinChars) {
pathIsAbsolute = true;
}
@microbial
microbial / msg-ctr.js
Created July 10, 2015 18:57
msg-ctr-for-jsbin
/*jshint strict:false */
'use strict';
// Create a new angular module.
var MessageCenterModule = angular.module('MessageCenterModule', []);
// Define a service to inject.
MessageCenterModule
.provider("$messageCenterService", function() {
var _this = this;
@microbial
microbial / app_access_global.js
Created December 4, 2015 04:27
Middleware with access to app instance
var express = require('express');
var app = express();
//Normal way - won't work if function is extracted to a module
app.use(function(req, res, next) {
'use strict';
app.locals.greeting = 'hello';
next();
@microbial
microbial / user_record_on_register.js
Created January 11, 2016 21:06
Make user node in firebase
//Assuming you're already in an angular controller...
$scope.user = {};
//$scope.user will get filled with "email" and "password" keys
var enteredUsername = angular.copy($scope.username);
$scope.register = function() {
var ref = new Firebase("https://<YOUR-FIREBASE-APP>.firebaseio.com");
var user = angular.copy($scope.user);
ref.createUser({
<!DOCTYPE html>
<html>
<head>
<style>
.editor { font-family: 'Roboto Mono', monospace; font-size: 12px; outline: none; overflow-y: auto; padding-left: 48px; counter-reset: line; }
.editor div { display: block; position: relative; white-space: pre-wrap; }
.editor div::before { content: counter(line); counter-increment: line; position: absolute; right: calc(100% + 16px); opacity: 0.5; }
</style>
</head>
// Check if the user is ready to play!
confirm("Are you ready to play!");
var age= prompt("What is your age?");
if (age< 13)
{
//do this code//
confirm("ask your parent if you can play.");
}
else
//"otherwise"//
@microbial
microbial / ezzyfivey.js
Last active May 17, 2024 02:09
es6-style-js
//NON ES6 way
function actionWord () {
//Put your action here
}
//for example
//CREATE the function
function drive () {
console.log('I am driving now')
}
@microbial
microbial / shop.js
Created February 16, 2016 08:00
Shopping List
var arr = [];
var obj = {};
var fun = function () {};
var shoppingList = [
'cheese',
'milk',
'bacon'
];