Skip to content

Instantly share code, notes, and snippets.

View v2keener's full-sized avatar

Gustavo (Keener) DeLaFuerza v2keener

View GitHub Profile
@v2keener
v2keener / list-files-size-in-KB-then-filenames.sh
Last active February 2, 2024 16:42
list files with size as kilobytes
#!/usr/bin/bash
# "input field separator" (IFS) to newline (0x0a)
IFS=$'\n'
# for i in
# tail result of `ls -lt` except the first line
for i in $(ls -lt | tail -n $(echo "$(ls -lt | wc -l) - 1" | bc) )
do
size=$(echo "$(echo $i | awk '{print $5}') / 1024" | bc)
file=$(echo $i | awk '{print $9}')
@v2keener
v2keener / simple-bit.js
Created March 30, 2023 13:42
This is a simple app that displays "Yes" or "No" to a random number
/* the working copy of this as of 2023 03 30 at 09:00 is https://jsbin.com/varoyit/edit?output */
/*
I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace
so it's better encapsulated. Now you can have multiple random number generators
and they won't stomp all over each other's state.
If you want to use this as a substitute for Math.random(), use the random()
method like so:
@v2keener
v2keener / gdlf-jandedobbeleer.omp.json
Last active March 9, 2023 20:41
This is my 2-line riff on Jan DeDobbeleer's (1-line) theme for oh-my-posh. It composes the os list "properties" from another theme to display an OS nerd font icon
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"blocks": [
{
"alignment": "left",
"segments": [
{
"background": "#c386f1",
"foreground": "#ffffff",
"leading_diamond": "\ue0b6",
#!/bin/bash
for i in {2..20}; do ping -w 1 -c 1 192.168.1.$i; done | grep ttl
@v2keener
v2keener / refresh-network-safely.sh
Last active June 16, 2018 13:35
Change /etc/network/interfaces as an idempotent transaction with /etc/network/new-interfaces as the new settings to try
#!/bin/bash
# This takes about 2 minutes, unless the /etc/network/new-interfaces works,
# in which case use atq and atrm to stop the "refresh-network-safely-at.txt"
# commands from happening
d=$(date +%Y%m%d-%H%M)
backup=$d-interfaces
cp /etc/network/interfaces /etc/network/$backup
cp /etc/network/interfaces /etc/network/temp-backup
cp /etc/network/new-interfaces /etc/network/interfaces
@v2keener
v2keener / workingDir.go
Last active March 1, 2018 23:03 — forked from arxdsilva/working_directory.go
How to get the current working directory in golang
/*
This is not secure or recommended for anything other than testing.
Published under MIT or GPL with the most permissiveness
(whichever). No warranty implied or otherwise. Based on the gist
from which it was forked.
2018 03 01
Gustavo Keener
*/
@v2keener
v2keener / directoryhttpserver.go
Last active March 1, 2018 23:04
Golang Static Webserver (for current directory)
/*
This is not secure or recommended for anything other than testing.
Published under MIT or GPL with the most permissiveness
(whichever). No warranty implied or otherwise.
2018 03 01
Gustavo Keener
*/
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Simple Bit</title>
</head>
<body>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<div style="font-family:Calibri, Arial, sans-serif">
@v2keener
v2keener / index.html
Created December 7, 2017 21:57
Simple Bit // source http://jsbin.com/cexolon
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Simple Bit</title>
</head>
<body>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<div style="font-family:Calibri, Arial, sans-serif">
@v2keener
v2keener / index.html
Created December 7, 2017 21:53
Simple Bit // source http://jsbin.com/cexolon
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>Simple Bit</title>
</head>
<body>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<div>