Skip to content

Instantly share code, notes, and snippets.

View Iristyle's full-sized avatar

Ethan J. Brown Iristyle

View GitHub Profile
@bitshifter
bitshifter / PurgeStandbyList.cpp
Last active June 19, 2024 19:42
Command line utility for purging Window's standby list. Requires /MANIFESTUAC:"level='highestAvailable'.
#include <windows.h>
#include <stdio.h>
#include <tchar.h>
#define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
#define STATUS_PRIVILEGE_NOT_HELD ((NTSTATUS)0xC0000061L)
typedef enum _SYSTEM_INFORMATION_CLASS {
SystemMemoryListInformation = 80, // 80, q: SYSTEM_MEMORY_LIST_INFORMATION; s: SYSTEM_MEMORY_LIST_COMMAND (requires SeProfileSingleProcessPrivilege)
} SYSTEM_INFORMATION_CLASS;
@Kartones
Kartones / postgres-cheatsheet.md
Last active May 12, 2025 01:59
PostgreSQL command line cheatsheet

PSQL

Magic words:

psql -U postgres

Some interesting flags (to see all, use -h or --help depending on your psql version):

  • -E: will describe the underlaying queries of the \ commands (cool for learning!)
  • -l: psql will list all databases and then exit (useful if the user you connect with doesn't has a default database, like at AWS RDS)
@moertel
moertel / suppress_ruby_output.rb
Last active March 21, 2024 08:54
Temporarily suppress STDOUT and STDERR (ruby)
# Temporarily redirects STDOUT and STDERR to /dev/null
# but does print exceptions should there occur any.
# Call as:
# suppress_output { puts 'never printed' }
#
def suppress_output
original_stderr = $stderr.clone
original_stdout = $stdout.clone
$stderr.reopen(File.new('/dev/null', 'w'))
$stdout.reopen(File.new('/dev/null', 'w'))
@lfender6445
lfender6445 / gist:9919357
Last active May 13, 2025 16:00
Pry Cheat Sheet

Pry Cheat Sheet

Command Line

  • pry -r ./config/app_init_file.rb - load your app into a pry session (look at the file loaded by config.ru)
  • pry -r ./config/environment.rb - load your rails into a pry session

Debugger

@Nora-Ballard
Nora-Ballard / sAMAccountName.ldif
Created February 20, 2014 22:42
LDIF for adding sAMAccountName attribute to the directory. Useful for adding this attribute to ADAM/ADLDS schema for use with 'userProxy' objects.
# ==================================================================
#
# This file should be imported with the following command:
# ldifde -i -u -f test3.ldf -s server:port -b username domain password -j . -c "cn=Configuration,dc=X" #configurationNamingContext
# LDIFDE.EXE from AD/AM V1.0 or above must be used.
# This LDIF file should be imported into AD or AD/AM. It may not work for other directories.
#
# ==================================================================
# ==================================================================
@jbinto
jbinto / howto-recover-google-authenticator-keys.txt
Created February 8, 2014 04:20
Recovering Google Authenticator keys from Android device for backup
### Last tested February 7 2014 on a Galaxy S3 (d2att) running Cyanogenmod 11 nightly, with Google Authenticator 2.49.
### Device with Google Authenticator must have root.
### Computer requires Android Developer Tools and SQLite 3.
### Connect your device in USB debugging mode.
$ cd /tmp
$ adb root
$ adb pull /data/data/com.google.android.apps.authenticator2/databases/databases
@chrisn
chrisn / popen3_test
Last active March 2, 2023 08:48
Ruby example of using Open3.popen3 with a select loop to read a child process's standard output and standard error streams.
#!/usr/bin/env ruby
require 'open3'
# Returns true if all files are EOF
#
def all_eof(files)
files.find { |f| !f.eof }.nil?
end
@bradwilson
bradwilson / vs2013-normal-menus.ps1
Created November 2, 2013 16:55
Say goodbye to VS2013's SHOUTING MENUS
Set-ItemProperty -Path HKCU:\Software\Microsoft\VisualStudio\12.0\General -Name SuppressUppercaseConversion -Type DWord -Value 1
anonymous
anonymous / setup.log
Created August 28, 2013 01:12
setup.log and setup.log.full - Cygwin failures on Windows 8 packer box
2013/08/27 15:37:36 Starting cygwin install, version 2.774
2013/08/27 15:37:36 User has backup/restore rights
2013/08/27 15:37:36 io_stream_cygfile: fopen(/etc/setup/setup.rc) failed 2 No such file or directory
2013/08/27 15:37:36 io_stream_cygfile: fopen(/etc/setup/last-cache) failed 2 No such file or directory
2013/08/27 15:37:36 io_stream_cygfile: fopen(/etc/setup/last-action) failed 2 No such file or directory
2013/08/27 15:37:36 io_stream_cygfile: fopen(/etc/setup/net-method) failed 2 No such file or directory
2013/08/27 15:37:36 io_stream_cygfile: fopen(/etc/setup/net-proxy-host) failed 2 No such file or directory
2013/08/27 15:37:36 io_stream_cygfile: fopen(/etc/setup/net-proxy-port) failed 2 No such file or directory
2013/08/27 15:37:36 io_stream_cygfile: fopen(/etc/setup/extrakeys) failed 2 No such file or directory
2013/08/27 15:37:36 io_stream_cygfile: fopen(/etc/setup/chooser_window_settings) failed 2 No such file or directory
@grenade
grenade / 01-generate-ed25519-ssh-key.sh
Last active April 11, 2025 19:59
generate ed25519 ssh and gpg/pgp keys and set file permissions for ssh keys and config
#!/bin/bash
mkdir -p ~/.ssh
# generate new personal ed25519 ssh keys
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "rob thijssen <[email protected]>"
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_robtn -C "rob thijssen <[email protected]>"
# generate new host cert authority (host_ca) ed25519 ssh key
# used for signing host keys and creating host certs