Skip to content

Instantly share code, notes, and snippets.

@danie7k
danie7k / user-command.sh
Created November 22, 2016 16:51
Run console command as another user
sudo -H -u www-data git status
@agarthetiger
agarthetiger / QuotesInJenkinsfiles.groovy
Last active April 17, 2025 20:20
Quoting strings and variable interpolation in Jenkinsfiles, passing values to shell tasks.
node{
timestamps{
stage('Samples'){
// Single quotes with no interpolation, at least not in Jenkins.
// The dollar variable will be evaluated before being run by the
// shell command, so variables which Jenkins makes available as
// environment variables can still be accessed from within a
// single-quoted string, passed to the sh task.
sh 'echo $PATH'
@forivall
forivall / axios-timing.ts
Last active March 21, 2024 16:38
Axios Timing helper POC
import http = require('http')
import https = require('https')
import url = require('url')
import {AxiosInstance, AxiosInterceptorManager} from 'axios'
import {HttpRequestOptions as HttpFollowRequestOptions, http as httpFollow, https as httpsFollow} from 'follow-redirects'
import now = require('performance-now')
import httpAdapter = require('axios/lib/adapters/http')
import InterceptorManager = require('axios/lib/core/InterceptorManager')
@0x3333
0x3333 / output.md
Last active August 22, 2024 14:05
Show Memory and CPU usage of kvm vms
RAM
---
vm-1                      = 1,024 MiB
vm-2                      = 2,048 MiB

Total: 3,072 MiB

CPU(s)
------
@bzerangue
bzerangue / json-to-ndjson.md
Last active April 17, 2025 12:09
JSON to NDJSON

NDJSON is a convenient format for storing or streaming structured data that may be processed one record at a time.

  • Each line is a valid JSON value
  • Line separator is ‘\n’

1. Convert JSON to NDJSON?

cat test.json | jq -c '.[]' > testNDJSON.json
@cvan
cvan / commands.js
Last active June 23, 2023 15:40
cypress disable basic css transitions + animations
// Custom Cypress No-Motion helper
//
// To reduce flakiness in Cypress tests caused by motion,
// force disable all CSS transitions and animations.
//
// revised: 2023-03-15
// credits: @ypresto
function disableMotion(win) {
const injectedStyleEl = win.document.getElementById('__cy_disable_motion__');
@juancsr
juancsr / mac-docker-withot-docker-destop.md
Last active April 23, 2025 17:06
Use docker in mac without docker-