Skip to content

Instantly share code, notes, and snippets.

View lcarsos's full-sized avatar

lcarsos

  • Denver, CO
View GitHub Profile
@lcarsos
lcarsos / restore_functionality.sh
Last active March 28, 2024 17:32
Repeatedly kill sentinelone so you can actually use the processor and ram on your mac
#!/usr/bin/env bash
# Usage: sudo ./restore_functionality.sh
#ps aux | grep sentinel | awk -F " +" '{print $2}' | xargs kill
while true; do
launchctl kill SIGKILL system/com.crowdstrike.falcond
launchctl kill SIGKILL system/com.crowdstrike.userdaemon
launchctl kill SIGKILL system/com.sentinelone.sentineld
launchctl kill SIGKILL system/com.sentinelone.sentineld-helper
@lcarsos
lcarsos / range.js
Created November 21, 2017 23:11
Two range calculating functions using idiomatic ES6
export const stepout = (min, max, step = 1) => (
Array( Math.floor((max - min) / step) ).fill().map( ( _, i ) => min + (i * step) )
);
export const linspace = (min, max, n = 100) => {
const step = (max - min) / (n - 1);
return Array( n ).fill().map( ( _, i ) => min + (i * step) );
};
export default stepout;
@lcarsos
lcarsos / rotate.sh
Created August 2, 2017 15:19
A simple bash function that imitates the functionality of log rotate
#!/usr/bin/env bash
# Immitates log rotate.
# You should change maxsize and rotatemax to your own use case.
rotate() {
local file=$1
local rotatemax=9 # The max number of numbered files to keep around
local maxsize=2097152 # After the main file passes this threshold rotate occurs
local filesize=$(wc -c $file | cut -f 1 -d ' ')
@lcarsos
lcarsos / Ergodox-layout.kbd.json
Last active October 21, 2016 07:40
Ergodox layout
[
{
"name": "Ergodox layout",
"switchMount": "cherry",
"switchBrand": "cherry",
"switchType": "MX1A-G1xx",
"plate": true
},
[
{
@lcarsos
lcarsos / copy_mp3_to_usb_devices.sh
Created August 24, 2015 06:18
Format all passed in block devices, then copy all MP3 files onto those devices.
#!/bin/bash
# -----------------------------------------------------------------------------
# "THE BEER-WARE LICENSE" (Revision 42):
# <ezekiel@lcarsos.com> wrote this file. As long as you retain this notice
# you can do whatever you want with this stuff. If we meet some day, and you
# think this stuff is worth it, you can buy me a beer in return.
# Ezekiel Chopper
# -----------------------------------------------------------------------------
if [[ "$#" -lt "1" ]]; then
@lcarsos
lcarsos / circular.h
Last active August 29, 2015 14:19
C++ Fixed Size Circular Array
#ifndef CIRCULAR_H
#define CIRCULAR_H
/**
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
* <ezekiel@lcarsos.com> wrote this file. As long as you retain this notice
* you can do whatever you want with this stuff. If we meet some day, and you
* think this stuff is worth it, you can buy me a beer in return.
* Ezekiel Chopper
### Keybase proof
I hereby claim:
* I am lcarsos on github.
* I am lcarsos (https://keybase.io/lcarsos) on keybase.
* I have a public key whose fingerprint is C330 88F9 69CB F0FB 5BE1 91F7 3A22 335A 20F5 8908
To claim this, I am signing this object:
# $env:USERPROFILE\Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1
$VIMPATH = "C:\Program Files (x86)\Vim\vim74\gvim.exe"
Set-Alias vi $VIMPATH
Set-Alias vim $VIMPATH
Set-Alias b Set-PSBreakpoint
# TODO define a function d to handle both these cases
Set-Alias d Remove-PSBreakpoint