Skip to content

Instantly share code, notes, and snippets.

View mrxinu's full-sized avatar

Steve Klassen mrxinu

View GitHub Profile
@mrxinu
mrxinu / recover_source_code.md
Created March 11, 2017 11:38 — forked from simonw/recover_source_code.md
How to recover lost Python source code if it's still resident in-memory

How to recover lost Python source code if it's still resident in-memory

I screwed up using git ("git checkout --" on the wrong file) and managed to delete the code I had just written... but it was still running in a process in a docker container. Here's how I got it back, using https://pypi.python.org/pypi/pyrasite/ and https://pypi.python.org/pypi/uncompyle6

Attach a shell to the docker container

Install GDB (needed by pyrasite)

apt-get update && apt-get install gdb
@mrxinu
mrxinu / settings.json
Created August 5, 2017 09:59 — forked from campoy/settings.json
My vscode settings
{
"window.zoomLevel": 0,
"go.lintOnSave": "package",
"editor.fontFamily": "'Fira Code', Menlo, Monaco, 'Courier New', monospace",
"editor.fontLigatures": false,
"workbench.iconTheme": "vs-seti",
"go.addTags": {
"tags": "json",
"options": "json=omitempty",
"promptForTags": true,
@mrxinu
mrxinu / boxstarter.ps1
Created September 18, 2017 15:17 — forked from jessfraz/boxstarter.ps1
Boxstarter Commands for a new Windows box.
# Description: Boxstarter Script
# Author: Jess Frazelle <jess@linux.com>
# Last Updated: 2017-09-11
#
# Install boxstarter:
# . { iwr -useb http://boxstarter.org/bootstrapper.ps1 } | iex; get-boxstarter -Force
#
# You might need to set: Set-ExecutionPolicy RemoteSigned
#
# Run this boxstarter by calling the following from an **elevated** command-prompt:
@mrxinu
mrxinu / Windows10-Setup.ps1
Created September 18, 2017 17:09 — forked from NickCraver/Windows10-Setup.ps1
(In Progress) PowerShell Script I use to customize my machines in the same way for privacy, search, UI, etc.
##################
# Privacy Settings
##################
# Privacy: Let apps use my advertising ID: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 0
# To Restore:
#Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AdvertisingInfo -Name Enabled -Type DWord -Value 1
# Privacy: SmartScreen Filter for Store Apps: Disable
Set-ItemProperty -Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\AppHost -Name EnableWebContentEvaluation -Type DWord -Value 0
@mrxinu
mrxinu / import_whd_tickets.rb
Created February 4, 2020 13:38 — forked from cw2908/import_whd_tickets.rb
Import Incidents from WHD export
# frozen_string_literal: true
#################################################################
##
## First install the wrapper & xml parser `gem install samanage nokogiri`
## To run `ruby import_whd_tickets.rb api-token export-file.csv`
##
##
## The CSV input columns were:
##
@mrxinu
mrxinu / values_pointers.go
Created April 26, 2020 21:36 — forked from josephspurrier/values_pointers.go
Golang - Asterisk and Ampersand Cheatsheet
/*
********************************************************************************
Golang - Asterisk and Ampersand Cheatsheet
********************************************************************************
Also available at: https://play.golang.org/p/lNpnS9j1ma
Allowed:
--------
p := Person{"Steve", 28} stores the value
<AlertDefinition xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/SolarWinds.Orion.Core.Alerting.Models">
<AlertID>1009</AlertID>
<AlertMessage>All replication neighbors are dead</AlertMessage>
<AlertRefID>74913425-d003-4b48-bcb0-96a049f31ce6</AlertRefID>
<Canned>false</Canned>
<Category />
<CreatedBy>omavel</CreatedBy>
<CustomProperties xmlns:d2p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">

Run from the command ruby script_name.rb API_TOKEN 2018-01-01 2018-12-31 or ruby script_name.rb API_TOKEN 2018-01-01 2018-12-31 eu if on the EU datacenter.

# ruby script_name.rb API_TOKEN 2019-01-01 2019-12-31
require 'samanage'
require 'csv'

api_token, start_date, end_date, datacenter = ARGV
@samanage = Samanage::Api.new(token: api_token, datacenter: datacenter)
DEFAULT_FILENAME = "Incident Report #{DateTime.now.strftime("%b-%d-%Y-%l%M")}.csv"
package main
import (
"bytes"
"flag"
"image"
"image/color"
"image/draw"
"image/png"
"math"
@mrxinu
mrxinu / gfx-sprator.go
Created November 11, 2020 12:57 — forked from peterhellberg/gfx-sprator.go
Sprator using gfx inspired by https://github.com/yurkth/sprator
package main
import (
"flag"
"image"
"image/color"
"time"
"github.com/peterhellberg/gfx"
)