Skip to content

Instantly share code, notes, and snippets.

View randomvariable's full-sized avatar
⬇️
Downstream. I may be slow to respond.

Naadir Jeewa randomvariable

⬇️
Downstream. I may be slow to respond.
View GitHub Profile
@randomvariable
randomvariable / New-PivotKlaxon.ps1
Last active August 29, 2015 14:06
New-PivotKlaxon
Function New-PivotKlaxon
{
Add-Type -AssemblyName PresentationCore
$song = [uri](Join-Path (Split-Path -parent $PSCommandPath) "klaxon.mp3")
$MediaPlayer = New-Object System.Windows.Media.MediaPlayer
$voice = new-object -com SAPI.SpVoice
$MediaPlayer.Open($song)
while( $MediaPlayer.NaturalDuration.TimeSpan.TotalMilliseconds -eq $null)
{
start-sleep -milliseconds 100
@randomvariable
randomvariable / get_rds_stats.rb
Created January 20, 2015 17:33
Get some stats on RDS
#!/usr/bin/env ruby
require 'aws-sdk'
@cw = AWS::CloudWatch::Client.new
@rds = AWS::RDS::Client.new
instances = @rds.describe_db_instances[:db_instances]
instances.map do |i|
id = i[:db_instance_identifier]
allocated_storage = i[:allocated_storage]
Add-Type -TypeDefinition @"
using System;
using System.Management.Automation;
[AttributeUsageAttribute(AttributeTargets.Class)]
public class NewCustomAttribute : CmdletCommonMetadataAttribute {
@randomvariable
randomvariable / gist:6380009
Created August 29, 2013 16:00
Check if a user is a member of a group
# Create a Windows Identity Principal (note the cast)
$principal = [Security.Principal.WindowsPrincipal](new-object System.Security.Principal.WindowsIdentity("<username>@<domain>"))
# Check if it is a member of a group
$princial.IsInRole("<domain>\<group name>")
# Other useful things you can do:
$identity = (new-object System.Security.Principal.WindowsIdentity("<username>@<domain>"))
@randomvariable
randomvariable / gist:6622746
Created September 19, 2013 12:31
Script Resource Issue
Script MongoDBAdminConfiguration
{
SetScript =
{
import-module gac
Add-Type -AssemblyName (Get-GACAssembly "MongoDB.Bson")
Add-Type -AssemblyName (Get-GACAssembly "MongoDB.Driver")
$client = new-object MongoDB.Driver.MongoClient("mongodb://localhost")
$server = $client.GetServer()
$adminDB = $server.GetDatabase("admin")
@randomvariable
randomvariable / rdsprint.sh
Last active June 14, 2016 10:33
Print RDS parameters
aws rds describe-db-parameters --db-parameter-group-name <Parameter Group Name> | jq '.Parameters[] | select(.ParameterValue != null) | .ParameterName + "=" + .ParameterValue'
@randomvariable
randomvariable / keybase.md
Last active August 19, 2016 11:31
keybase.md

Keybase proof

I hereby claim:

  • I am randomvariable on github.
  • I am randomvariable (https://keybase.io/randomvariable) on keybase.
  • I have a public key whose fingerprint is F4D2 C447 1871 16A1 6CD2 A743 3E6C B2D0 9DC4 D5D0

To claim this, I am signing this object:

@randomvariable
randomvariable / windows_cpu_flags.rb
Created November 6, 2016 23:41
Getting supported CPU instructions on Windows
require 'ruby-wmi'
ECX_FLAGS = [
'SSE3',
'PCLMULQDQ',
'DTES64',
'MONITOR',
'DS-CPL',
'VMX',
'SMX',
@randomvariable
randomvariable / debug.txt
Created December 1, 2016 14:28
vagrant debug 1
 INFO global: Vagrant version: 1.9.0
INFO global: Ruby version: 2.2.5
INFO global: RubyGems version: 2.4.5.1
INFO global: VAGRANT_OLD_ENV_KONSOLE_DBUS_WINDOW="/Windows/1"
INFO global: VAGRANT_OLD_ENV_XDG_SEAT="seat0"
INFO global: VAGRANT_OLD_ENV_WINDOWID="75497477"
....
INFO global: VAGRANT_EXECUTABLE="/opt/vagrant/embedded/gems/gems/vagrant-1.9.0/bin/vagrant"
INFO global: VAGRANT_OLD_ENV_TERM="xterm-256color"
INFO global: VAGRANT_OLD_ENV_LOGNAME="naadir"
open("/etc/ld.so.cache", O_RDONLY|O_CLOEXEC) = 8
open("/lib64/libtinfo.so.6", O_RDONLY|O_CLOEXEC) = 8
open("/lib64/libdl.so.2", O_RDONLY|O_CLOEXEC) = 8
open("/lib64/libc.so.6", O_RDONLY|O_CLOEXEC) = 8
open("/dev/tty", O_RDWR|O_NONBLOCK) = 8
open("/usr/lib/locale/locale-archive", O_RDONLY|O_CLOEXEC) = 8
open("/usr/lib64/gconv/gconv-modules.cache", O_RDONLY) = 8
open("/opt/vagrant/embedded/bin/gem", O_RDONLY) = 8
--- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=18075, si_uid=1000, si_status=0, si_utime=0, si_stime=0} ---
open("/vagrant-substrate/staging/embedded/lib/tls/x86_64/libruby.so.2.2", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)