Skip to content

Instantly share code, notes, and snippets.

View norbinsh's full-sized avatar
🏗️
Building

Shay Elmualem norbinsh

🏗️
Building
View GitHub Profile
@norbinsh
norbinsh / gist:994d4c00e728ed0a6c42
Last active August 29, 2015 14:22
MSI install if enough processors - env:path *Practice*
#Making sure the variables used in the script have their value set to $null before starting
$cpu = $null;
$cpupath = $null;
$msipackage = $null;
#Declaring variables
$cpupath = (gci env:\NUMBER_OF_PROCESSORS).value;
$msipackage = 'c:\users\shay\desktop\package.msi'
#Requires -RunAsAdministrator
#Requires -Version 4.0
$VerbosePreference = 'Continue'
$DebugPreference = 'Continue'
$WarningPreference = 'Continue'
function Get-StartupItems {
[cmdletbinding()]
@norbinsh
norbinsh / Get-MyProcess
Last active August 29, 2015 14:23
practice...
$VerbosePreference = 'Continue'
$DebugPreference = 'Continue'
$WarningPreference = 'Continue'
$Root = "C:\"
$Folder = "C:\2012SG\"
$NestedFolder = "C:\2012SG\event3\"
$FullPath = "C:\2012SG\event3\process3.txt"
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
<OptionsSetting value="true" id="Checkout" />
<OptionsSetting value="true" id="Update" />
<OptionsSetting value="true" id="Status" />
<OptionsSetting value="true" id="Edit" />
<ConfirmationsSetting value="0" id="Add" />
import os
import configparser
config = configparser.ConfigParser()
config.read(os.path.dirname(__file__) + '/config.ini')
"""
Playing around with decorators.
"""
__author__ = 'Shay Elmualem'
import time
def calc_func_runtime(func):
"""
Playing around with decorators.
"""
__author__ = 'Shay Elmualem'
import time
import string
from threading import Thread
class Room:
def __init__(self, has_door=True):
self.has_door = has_door
self.color = "White"
def show(self):
return("Here's your door: [-]")
a = Room()
import re
import json
regex_pattern = r"^logzero_default - (\d{4}-\d\d-\d\d).*INFO: ([a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+), \d*. (.*).zip$"
input_file = 'logfile.log'
def return_rows(input_file):
with open(input_file, 'r') as inputf:
return inputf.read().splitlines()
import requests
import os
import time
def timeit(method):
def timed(*args, **kw):
ts = time.time()
result = method(*args, **kw)
te = time.time()