Skip to content

Instantly share code, notes, and snippets.

View DYW972's full-sized avatar
πŸ––
Life

Yohan Dunon DYW972

πŸ––
Life
View GitHub Profile
@joefreewave
joefreewave / gist:ed88dc587eb583c0412bcee87405bcf5
Created October 24, 2024 17:58
delete/uninstall gitlab runner from ubuntu 22.04
# delete/uninstall gitlab runner from ubuntu 22.04
# Stop and remove the service
sudo gitlab-runner stop
sudo gitlab-runner uninstall
sudo systemctl daemon-reload
# Remove gitlab-runner files and config
sudo rm -rf /usr/local/bin/gitlab-runner
sudo userdel gitlab-runner
sudo rm -rf /home/gitlab-runner/
@joshjohanning
joshjohanning / gitlab-create-merge-request.sh
Created March 30, 2023 21:52
create gitlab merge requests via the api
#!/bin/bash
GITLAB_URL="https://example.gitlab.com/"
PROJECT_ID="2" # get this id via the repo/project's overview page
ACCESS_TOKEN="glpat-abc"
# Create a new merge request
curl --header "Private-Token: $ACCESS_TOKEN" \
"$GITLAB_URL/api/v4/projects/$PROJECT_ID/merge_requests" \
--data "source_branch=my-branch" \
--data "target_branch=main" \
@koficoud
koficoud / mongodb_pass_reset.md
Last active July 21, 2023 07:27 — forked from shivampip/mongodb_pass_reset.md
MongoDB shell admin password reset
  • open mongod.conf
sudo nano /etc/mongod.conf
  • Comment security
#security:
#  authroization: "enabled"
@sindresorhus
sindresorhus / esm-package.md
Last active April 19, 2025 18:24
Pure ESM package

Pure ESM package

The package that linked you here is now pure ESM. It cannot be require()'d from CommonJS.

This means you have the following choices:

  1. Use ESM yourself. (preferred)
    Use import foo from 'foo' instead of const foo = require('foo') to import the package. You also need to put "type": "module" in your package.json and more. Follow the below guide.
  2. If the package is used in an async context, you could use await import(…) from CommonJS instead of require(…).
  3. Stay on the existing version of the package until you can move to ESM.
@habovh
habovh / zshrc_Apple_Terminal
Last active April 7, 2021 14:30
ZSH + Apple Terminal: set tab title current working directory for Mojave and earlier
# This is a slightly modified version of Mojave (10.14) script located in /etc/bashrc_Apple_Terminal
# modified to work with zsh.
# It mainly calls update_terminal_cwd when changing the working directory, which prints a special
# invisible string that Apple Terminal interprets and updates the current term title accordingly.
# Note : this script is useless for macOS Catalina and newer versions of macOS, since it should
# already contain at least this functionality.
# Instructions
# Place this file in /etc/ (alongside bash_Apple_Terminal)
@scriptingosx
scriptingosx / bash_prompt.sh
Last active June 23, 2022 19:13
Sample code for dynamic bash prompt that shows exit codes.
# PROMPT
# default macOS prompt is: \h:\W \u\$
# assemble the prompt string PS1
# inspired from: https://stackoverflow.com/a/16715681
function __build_prompt {
local EXIT="$?" # store current exit code
# define some colors
@carceneaux
carceneaux / remove_gitlab_artifacts.sh
Last active March 29, 2025 22:48
Script for removing GitLab Job Artifacts.
#!/bin/bash
#
# Written by Chris Arceneaux
# GitHub: https://github.com/carceneaux
# Email: [email protected]
# Website: http://arsano.ninja
#
# Note: This code is a stop-gap to erase Job Artifacts for a project. I HIGHLY recommend you leverage
# "artifacts:expire_in" in your .gitlab-ci.yml
#
@DavidWells
DavidWells / async-await-node-style-promises.js
Last active June 30, 2023 14:08
Nicer business logic with async wait promises that won't swallow native JS errors. Update to https://gist.github.com/DavidWells/54f9dd1af4a489e5f1358f33ce59e8ad where we handle native JS errors instead of potentially missing them. Now a package here https://www.npmjs.com/package/safe-await
/* Native Error types https://mzl.la/2Veh3TR */
const nativeExceptions = [
EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError
].filter((except) => typeof except === 'function')
/* Throw native errors. ref: https://bit.ly/2VsoCGE */
function throwNative(error) {
for (const Exception of nativeExceptions) {
if (error instanceof Exception) throw error
}
/* Helper buddy for removing async/await try/catch litter πŸ—‘ */
function O_o(promise) {
return promise.then(data => {
if (data instanceof Error) return [data]
return [null, data]
}).catch(err => [err])
}
/* Look ma, no try/catch */
async function usageExample(params) {
#!/usr/bin/env bash
echo "
----------------------
NODE & NPM
----------------------
"
# add nodejs 10 ppa (personal package archive) from nodesource
curl -sL https://deb.nodesource.com/setup_10.x | sudo -E bash -