Skip to content

Instantly share code, notes, and snippets.

View kenpb's full-sized avatar

Kenneth P. Barquero kenpb

  • Cartago, Costa Rica
View GitHub Profile
@kenpb
kenpb / users.ldif
Created July 11, 2022 06:37
Mock users with minimal AD compatibility using ldif and http://github.com/kwart/ldap-server check https://hub.docker.com/r/kenpb/ldap-ad-it
#########################################################
# MICROSOFT SCHEMA for sAMAccountName and memberOf
# these two attributes are not defined in Apache Directory Server
#########################################################
dn: cn=microsoft, ou=schema
objectclass: metaSchema
objectclass: top
cn: microsoft
@kenpb
kenpb / bash
Created August 8, 2018 19:52 — forked from jonashackt/bash
Remote debugging Spring Boot
### java -jar
java -Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8001,suspend=y -jar target/cxf-boot-simple-0.0.1-SNAPSHOT.jar
### Maven
Debug Spring Boot app with Maven:
mvn spring-boot:run -Drun.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=8001"
@kenpb
kenpb / app.module.ts
Last active July 11, 2018 15:01
A `round number` pipe for Angular from Bastien Donjon's blog, please check http://blog.bastien-donjon.fr/round-number-angular-2-pipe/
@NgModule({
imports: [
BrowserModule,
FormsModule,
HttpModule,
routing
],
declarations: [
AppComponent,
RoundPipe
#include <imapi2.h>
#include <imapi2error.h>
#include <imapi2fs.h>
#include <imapi2fserror.h>
void iampi2_cpp::convert2iso() {
HRESULT hres = 0;
CoInitialize(NULL);
IFileSystemImage* image = NULL;
IFileSystemImageResult* result = NULL;
@kenpb
kenpb / install-ruby-gems.sh
Last active April 6, 2016 07:51 — forked from scmx/upgrade-install-ruby-2-1-2-ubuntu-12-04.md
Upgrade/Install ruby 2.2.2 #ubuntu #12.04 #14.04 for vagrant
# Reference http://stackoverflow.com/a/18490935/2037928
sudo apt-get update --fix-missing
# Install needed packages
sudo apt-get -y install build-essential zlib1g-dev libssl-dev libreadline6-dev libyaml-dev
cd /tmp
# Download appropriate ruby version https://www.ruby-lang.org/en/downloads/
wget http://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.gz
@kenpb
kenpb / install-libsodium.sh
Created March 11, 2016 04:55 — forked from sarciszewski/install-libsodium.sh
Install libsodium-1.0.2 and PECL libsodium on Ubuntu 14.04
#!/usr/bin/env bash
PECLVER="0.1.1"
LIBSODIUMVER="1.0.2"
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
@kenpb
kenpb / Vagrantfile
Created February 10, 2016 08:02 — forked from phips/Vagrantfile
host1.vm.provider :vmware_fusion do |vmw|
vdiskmanager = '/Applications/VMware\ Fusion.app/Contents/Library/vmware-vdiskmanager'
dir = "#{ENV['PWD']}/.vagrant/additional-disks"
unless File.directory?( dir )
Dir.mkdir dir
end
file_to_disk = "#{dir}/hd2.vmdk"
unless File.exists?( file_to_disk )
`#{vdiskmanager} -c -s 10GB -a lsilogic -t 0 #{file_to_disk}`
end
@kenpb
kenpb / Vagrantfile
Created February 10, 2016 07:25 — forked from leifg/Vagrantfile
Add a second disk to system using vagrant
file_to_disk = './tmp/large_disk.vdi'
Vagrant::Config.run do |config|
config.vm.box = 'base'
config.vm.customize ['createhd', '--filename', file_to_disk, '--size', 500 * 1024]
config.vm.customize ['storageattach', :id, '--storagectl', 'SATA Controller', '--port', 1, '--device', 0, '--type', 'hdd', '--medium', file_to_disk]
end
function Remove-LocalUserProfile {
<#
.SYNOPSIS
Removes a local user profile from the local or remote computer.
.DESCRIPTION
Removes a local user profile from the local or a remote computer by getting the Win32_UserProfile WMIObject, translating the SIDs to
usernames, and removing the profile if the result matches the specified username.
.PARAMETER ComputerName
Name of the computer you want to remove the user from.
.PARAMETER User
@kenpb
kenpb / Microsoft.PowerShell_profile.ps1
Created November 26, 2015 21:24
My powershell console profile preferences
$shell = $host.ui.RawUI
# Buffersize
$buffer = $shell.BufferSize
$buffer.width = 120
$buffer.height = 2000
$shell.BufferSize = $buffer
# WindowSize
$size = $shell.WindowSize