Skip to content

Instantly share code, notes, and snippets.

View guimou's full-sized avatar

Guillaume Moutier guimou

  • Red Hat
  • Québec, Canada
View GitHub Profile
@guimou
guimou / gist:3e7b06c36a9247154808b6304a52db3f
Created March 1, 2017 15:17
Opens AD administration from command line (must be in admin mode) with another account
C:\Windows\System32\runas.exe /netonly /user:username@domainname "mmc %SystemRoot%\system32\dsa.msc /domain=domainname"
@guimou
guimou / gist:0150474e9d5a624a5fae701ac4ca7bd3
Created April 5, 2017 14:37
Macro to save all Outlook attachments and write saved location in message
Sub SaveAllAttachments()
'--> Define some constants
Const msoFileDialogFolderPicker = 4
'--> Define some variables
Dim olkMsg As Object, _
olkPos As Outlook.PostItem, _
intIdx As Integer, _
excApp As Object, _
objFSO As Object, _
@guimou
guimou / gist:57d6fd5712c0f7672afa7a793ef1f803
Created April 5, 2017 14:38
Macro to delete all Outlook attachments and write deleted filenames in message
Sub DeleteAllAttachments()
Dim olkMsg As Object, intIdx As Integer, strBuffer As String
For Each olkMsg In Application.ActiveExplorer.Selection
For intIdx = olkMsg.Attachments.Count To 1 Step -1
If Not IsHiddenAttachment(olkMsg.Attachments.Item(intIdx)) Then
strBuffer = strBuffer & olkMsg.Attachments.Item(intIdx).FileName & vbCrLf
olkMsg.Attachments.Item(intIdx).Delete
End If
Next
Select Case olkMsg.BodyFormat
while true; do sleep 1; curl http://template-ul-demo-ul.apps.10.2.2.2.xip.io/hostname; echo ' ';done
@guimou
guimou / http-to-s3.ipynb
Last active October 1, 2019 19:53
Python notebook: Transfer http-accessible data directly to a S3 bucket (no disk or memory usage)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@guimou
guimou / bashrc
Last active March 30, 2023 17:20
colored bash prompt (add to your .bashrc)
# .bashrc
#######################
# Colored bash prompt #
#######################
################################################################################
## FUNCTIONS ##
@guimou
guimou / pil_s3.py
Created December 11, 2019 20:13 — forked from ghandic/pil_s3.py
Load image from S3 directly into memory as PIL image and write to S3 directly from memory from PIL image
import boto3
from PIL import Image
from io import BytesIO
import os
class S3ImagesInvalidExtension(Exception):
pass
class S3ImagesUploadFailed(Exception):
pass
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import sys
import boto3
import numpy as np
import os
import logging
import json
import random
import http.server
import socketserver