Skip to content

Instantly share code, notes, and snippets.

View ValchanOficial's full-sized avatar
:octocat:
Happy Octocat

Valéria Padilha de Vargas ValchanOficial

:octocat:
Happy Octocat
View GitHub Profile
@ValchanOficial
ValchanOficial / gist:29a283aa78ff7b222d3dbab1fb873993
Created July 26, 2024 16:38
[WSL2][Docker][PowerShell][Win10/11] Command
wsl.exe -u root -e sh -c "service docker status || service docker start"
@ValchanOficial
ValchanOficial / convert-deploymentconfig-to-deployment.md
Created May 23, 2024 03:37 — forked from bmaupin/convert-deploymentconfig-to-deployment.md
Convert OpenShift DeploymentConfig to Kubernetes Deployment
  1. Change apiVersion from:

    - apiVersion: v1

    (or apiVersion: apps.openshift.io/v1)

    to:

@ValchanOficial
ValchanOficial / xmlParser.ts
Created May 22, 2024 06:22 — forked from Aravin/xmlParser.ts
Converting JSON toXML& XML to JSON in Node.js using xml2js package in TypeScript
import { parseString, Builder } from "xml2js";
// Convert string/XML to JSON
function toJson(xml: string) {
parseString(xml, { explicitArray: false }, function(error, result) {
console.log(result);
});
}
@ValchanOficial
ValchanOficial / update-git.sh
Created April 22, 2024 13:48 — forked from YuMS/update-git.sh
Update git to latest version on Ubuntu
#!/bin/bash
sudo add-apt-repository -y ppa:git-core/ppa
sudo apt-get update
sudo apt-get install git -y
@ValchanOficial
ValchanOficial / gist:99913fd8f5ae1f7e4c9c4156e282c887
Created April 14, 2024 00:17
[Javascript] Create alphanumeric code
export const alphanumeric = (len) => {
const str = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
return [...Array(len)].reduce(
(a) => a + str[~~(Math.random() * str.length)],
""
);
};
console.log(alphanumeric(6)); // HNF2RU
@ValchanOficial
ValchanOficial / gist:e34d3ff1bb5bf7b44577fbc681661dac
Last active March 18, 2024 15:11
[Javascript] replaceAt and regex matches between symbol
// https://stackoverflow.com/a/1431113/11842937
const replaceAt = function(str, index, replacement) {
return str.substring(0, index) + replacement + str.substring(index + replacement.length);
}
https://regexr.com/ - regex matches between symbol
regex = new RegExp(`^\\${symbol}(.*)\\${symbol}$`, 'gm')
g = global
m = multiline
function centuryFromYear(year) {
return Math.ceil(year / 100)
}
function isPalindrome(word) {
return word === word.split('').reverse().join('')
}
import "./styles.css";
import Stripe from "stripe";
const lineItems = [
{
price: "price_123",
quantity: 1,
},
];
package.json
{
"name": "config",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"test": "npx jest --runInBand test/",
"test:dev": "npx jest --runInBand --watchAll test/",