Skip to content

Instantly share code, notes, and snippets.

@zionyx
zionyx / largestFiles.py
Created September 7, 2015 12:21 — forked from nk9/largestFiles.py
Python script to find the largest files in a git repository.
#!/usr/bin/python
# -*- coding: utf-8 -*-
# Python script to find the largest files in a git repository.
# The general method is based on the script in this blog post:
# http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
#
# The above script worked for me, but was very slow on my 11GB repository. This version has a bunch
# of changes to speed things up to a more reasonable time. It takes less than a minute on repos with 250K objects.
@zionyx
zionyx / setupVSEnv.py
Last active June 11, 2016 22:04 — forked from stania/setupVSEnv.py
python implementation replacing "call vsvars32.bat"
import os
import subprocess as sub
def vs_env_dict(vsver):
cmd = r'cmd /s /c ""%VS{0}COMNTOOLS%vsvars32.bat" & set"'.format(vsver)
output = sub.Popen(cmd, stdout=sub.PIPE, stderr=sub.STDOUT, stdin=sub.PIPE).communicate()[0].split(os.linesep)
return dict((e[0].upper(), e[1]) for e in [p.rstrip().split("=", 1) for p in output] if len(e) == 2)
# -*- coding: utf-8 -*-
"""Demonstrate high quality docstrings.
Module-level docstrings appear as the first "statement" in a module. Remember,
that while strings are regular Python statements, comments are not, so an
inline comment may precede the module-level docstring.
After importing a module, you can access this special string object through the
``__doc__`` attribute; yes, it's actually available as a runtime attribute,
despite not being given an explicit name! The ``__doc__`` attribute is also
@zionyx
zionyx / cleanupUnusedWorkspaceInSlaves.groovy
Created September 16, 2016 13:17 — forked from ceilfors/cleanupUnusedWorkspaceInSlaves.groovy
When you delete jobs in Jenkins, the corresponding workspaces in the build slaves won't be deleted automatically. This Jenkins script will go to each slave and check if the jobs are already deleted in Jenkins master and delete the workspace.
import com.cloudbees.hudson.plugins.folder.Folder
import hudson.FilePath
import jenkins.model.Jenkins
def boolean isFolder(String name) {
def item = Jenkins.instance.getItemByFullName(name)
return item instanceof Folder
}
def deleteUnusedWorkspace(FilePath root, String path) {
@zionyx
zionyx / DelCert.cpp
Created October 3, 2016 20:11
Someone wrote a cool tool that removes certificates from signed files.
#define _WIN32_WINNT 0x0400
#include <stdio.h>
#include <windows.h>
#include <Wincrypt.h>
#define MY_ENCODING_TYPE (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING)
void MyHandleError(char *s);
void main(void)
{
//-------------------------------------------------------------------
@zionyx
zionyx / Create-Jenkins-Slave-On-Windows-Server-Core.ps1
Last active October 7, 2016 22:02 — forked from PlagueHO/ Create-Jenkins-Slave-On-Windows-Server-Core.ps1
Create a Jenkins Slave on a Windows Server 2012 R2 Core install
# Configure the settings to use to setup this Jenkins Slave
$IPAddress = '192.168.1.96'
$SubnetPrefixLength = 24
$DNSServers = @('192.168.1.1')
$DefaultGateway = '192.168.1.1'
$JenkinsSlaveFolder = 'c:\jenkins'
# Install .NET Framework 3.5
Install-WindowsFeature -Name NET-Framework-Core
@zionyx
zionyx / gist:403027aa4752bb382a44308fbe8c4470
Created November 30, 2016 13:53 — forked from trodrigues/gist:1023167
Checkout only certain branches with git-svn
If you want to clone an svn repository with git-svn but don't want it to push all the existing branches, here's what you should do.
* Clone with git-svn using the -T parameter to define your trunk path inside the svnrepo, at the same time instructing it to clone only the trunk:
git svn clone -T trunk http://example.com/PROJECT
* If instead of cloning trunk you just want to clone a certain branch, do the same thing but change the path given to -T:
git svn clone -T branches/somefeature http://example.com/PROJECT
@zionyx
zionyx / keybindings.json
Created March 28, 2017 09:58
Personal vscode keybindings. Also fixes an annoyance: Escape to close Find widget window when it is focused.
// Place your key bindings in this file to overwrite the defaults
[
{ "key": "ctrl+shift+o", "command": "workbench.action.files.openFolder" },
{ "key": "ctrl+k ctrl+d", "command": "editor.action.formatDocument" },
{ "key": "escape", "command": "closeFindWidget",
"when": "findWidgetFocus && findWidgetVisible" }
]
# Get the UnitTest Binaries
$files = Get-ChildItem $TestAssembliesDir\*est*.dll
# VSTest.console.exe path
$VSTestPath = 'C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe'
# MSTest path
$MSTestpath = "C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\mstest.exe"
# Loop through the test assemblies and add them to the VSTestFiles
@zionyx
zionyx / profile.ps1
Created October 22, 2018 09:10
PowerShell profile without Docker commands
# Chocolatey profile
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
if (Test-Path($ChocolateyProfile)) {
Import-Module "$ChocolateyProfile"
}
#try { $null = gcm pshazz -ea stop; pshazz init } catch { }
$env:PYTHONIOENCODING="utf-8"
# TLS 1.2 support
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12 -bor