Skip to content

Instantly share code, notes, and snippets.

Rhett C rhettc

Block or report user

Report or block rhettc

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@rhettc
rhettc / reclaimWindows10.ps1
Last active Nov 6, 2019 — forked from alirobe/reclaimWindows10.ps1
This Windows 10 Setup Script turns off a bunch of unnecessary Windows 10 telemetery, bloatware, & privacy things. Not guaranteed to catch everything. Review and tweak before running. Reboot after running. Scripts for reversing are included and commented. Fork of https://github.com/Disassembler0/Win10-Initial-Setup-Script (different defaults). N.…
View reclaimWindows10.ps1
##########
# Tweaked Win10 Initial Setup Script
# Primary Author: Disassembler <disassembler@dasm.cz>
# Modified by: alirobe <alirobe@alirobe.com> based on my personal preferences.
# Version: 2.20.2, 2018-09-14
# Primary Author Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script
# Tweaked Source: https://gist.github.com/alirobe/7f3b34ad89a159e6daa1/
# Tweak difference:
#
# @alirobe's version is a subset focused on safely disabling telemetry, some 'smart' features and 3rd party bloat ...
View async_await_best_practices_cheatsheet.md

Async Await Best Practices Cheat Sheet

Summary of Asynchronous Programming Guidelines

Name Description Exceptions
Avoid async void Prefer async Task methods over async void methods Event handlers
Async all the way Don't mix blocking and async code Console main method
Configure context Use ConfigureAwait(false) when you can Methods that require con­text
@rhettc
rhettc / Puzzle.ino
Last active May 11, 2016
Extract Method
View Puzzle.ino
void setupButton(int pin, Bounce debouncer)
{
pinMode(pin, INPUT_PULLUP);
// configure the de-bounce for this button
debouncer.attach(pin);
debouncer.interval(5);
}
void setup() {
@rhettc
rhettc / gist:ba33e5b58b2dcf0c0c04
Created Nov 17, 2014
use find to duplicate the parent directory’s structure into the current directory, files are not copied
View gist:ba33e5b58b2dcf0c0c04
# given the structure
../foo/bar
../fizz/bang
../beep
# move into the beep child dir and run the command
cd beep
find ../ -mindepth 1 -type d -printf "%P\0" | xargs --null mkdir
# now beep has the same structure
./foo/bar
./fizz/bang
View Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace TemplateFoo
{
class Program
{
View big_consumers.sh
du -chd1 -t1G
# include grand total, friendly sizes, max depth 1, greater than 1G
View Arduino Song
const int c = 261;
const int d = 294;
const int e = 329;
const int f = 349;
const int g = 391;
const int gS = 415;
const int a = 440;
const int aS = 455;
const int b = 466;
const int cH = 523;
@rhettc
rhettc / pgactivity
Created Apr 16, 2014
Show open connections to databases in a brief format conducive to CLI usage
View pgactivity
SELECT procpid as pid,
usename as user,
datname as db,
application_name as app, waiting as wait, current_query as query
FROM pg_stat_activity
WHERE datname <> 'postgres';
View hb-test.py
#!/usr/bin/env python2
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
View .pryrc
def app_path
unless @app_path
git_root = `git rev-parse --show-toplevel`.chomp
@app_path = $?.success? ? git_root : Dir.pwd
end
@app_path
end
class Exception
You can’t perform that action at this time.