Skip to content

Instantly share code, notes, and snippets.

View peter-avila's full-sized avatar

Peter Avila peter-avila

View GitHub Profile
@peter-avila
peter-avila / node.js_output_to_file.txt
Created June 29, 2023 06:04 — forked from eddex/node.js_output_to_file.txt
redirect node.js console output to file
Just run the script in your terminal like this...
node script-file.js > log-file.txt
This tells the shell to write the standard output of the command node script-file.js to your log file instead of the default, which is printing it to the console.
This is called redirection and its very powerful. Say you wanted to write all errors to a separate file...
node script-file.js >log-file.txt 2>error-file.txt
Now all console.log are written to log-file.txt and all console.error are written to error.txt
@peter-avila
peter-avila / mongodb_shell_commands.md
Created June 1, 2023 13:22 — forked from michaeltreat/mongodb_shell_commands.md
Quick Cheat Sheet for Mongo DB Shell commands.

MongoDB Shell Commands Cheat Sheet.

This is a Cheat Sheet for interacting with the Mongo Shell ( mongo on your command line). This is for MongoDB Community Edition.

Preface:

Mongo Manual can help you with getting started using the Shell.

FAQ for MongoDB Fundamentals and other FAQs can be found in the side-bar after visiting that link.

@peter-avila
peter-avila / 10-hibernate.conf
Created November 6, 2022 12:29 — forked from redraw/10-hibernate.conf
hibernate kde neon
# particion swap size = ram
# gettear UUID con blkid
# en /etc/grub/default agregar,
# quiet splash resume=UUID=<UUID-swap-partition>
# sudo update-grub
# sudo vim /etc/polkit-1/localauthority.conf.d/10-hibernate.conf
[Re-enable hibernate by default for login1]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate
/**
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
* https://developers.google.com/apps-script/service_spreadsheet
*/
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
@peter-avila
peter-avila / Cloneuser.sh
Created October 29, 2021 02:08 — forked from rubiread/Cloneuser.sh
clone linux user
#!/bin/bash
# clone a user
# usage:
# if you named this as below then
# change to the directory and run this command
# sudo bash clone-user.sh
echo "============="
echo "this script will create a new user"
@peter-avila
peter-avila / boxstarter.ps1
Created August 3, 2021 20:18 — forked from jeebak/boxstarter.ps1
My Boxstarter Script
#
# https://github.com/tknerr/bills-kitchen
# All you need for cooking with Chef and Vagrant on Windows you will find in Bill's Kitchen
# https://github.com/tknerr/linus-kitchen
# An Ubuntu-based developer VM for hacking with Chef, Vagrant, Docker & Co
#
# Based on: https://github.com/felixrieseberg/windows-development-environment
# Test-Admin is not available yet, so use...
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
@peter-avila
peter-avila / bootstrapwindows10.ps1
Created August 3, 2021 20:14 — forked from zloeber/bootstrapwindows10.ps1
Boxstarter Windows 10 Configuration
<#
The command to run, built from the raw link of this gist
Win+R
iexplore http://boxstarter.org/package/url?<RAW GIST LINK>
OR (if you don't like the way the web launcher force re-installs everything)

Option 1: Command-line download extension as zip and extract

extension_id=jifpbeccnghkjeaalbbjmodiffmgedin   # change this ID
curl -L -o "$extension_id.zip" "https://clients2.google.com/service/update2/crx?response=redirect&os=mac&arch=x86-64&nacl_arch=x86-64&prod=chromecrx&prodchannel=stable&prodversion=44.0.2403.130&x=id%3D$extension_id%26uc" 
unzip -d "$extension_id-source" "$extension_id.zip"

Thx to crxviewer for the magic download URL.

#
# ~/.bashrc
#
[[ $- != *i* ]] && return
colors() {
local fgc bgc vals seq0
printf "Color escapes are %s\n" '\e[${value};...;${value}m'