Skip to content

Instantly share code, notes, and snippets.

View bkmeneguello's full-sized avatar

Bruno Meneguello bkmeneguello

View GitHub Profile
@kellyrob99
kellyrob99 / jenkinsGroovyShell.groovy
Created February 26, 2012 01:09
Launch an interactive Groovy shell to a Jenkins server
@GrabResolver(name = 'glassfish', root = 'http://maven.glassfish.org/content/groups/public/')
@GrabResolver(name = "github", root = "http://kellyrob99.github.com/Jenkins-api-tour/repository")
@Grab('org.kar:hudson-api:0.2-SNAPSHOT')
@GrabExclude('org.codehaus.groovy:groovy')
import org.kar.hudson.api.cli.HudsonCliApi
/**
* Open an interactive Groovy shell that imports the hudson.model.* classes and exposes
* a 'hudson' and/or 'jenkins' object in the Binding which is an instance of hudson.model.Hudson
*/
HudsonCliApi cliApi = new HudsonCliApi()
@simonmcc
simonmcc / route53DynDNS.bash
Created July 22, 2012 21:06
Amazon Route 53 Dynamic DNS Updater Script
#!/bin/bash
#
# This script requires xpath to parse part of the dnscurl.pl output
# on CentOS/RedHat/Amazon Linux:
#
# sudo yum install perl-XML-XPath
#
# also, dnscurl.pl (from http://aws.amazon.com/code/Amazon-Route-53/9706686376855511)
# expects your secrets to be in ~/.aws-secrets
# using a file format like this (from http://dmz.us/wp/wp-content/uploads/r53/aws-secrets.txt)
@afair
afair / tmux.cheat
Last active October 11, 2023 13:48
Tmux Quick Reference & Cheat sheet - 2 column format for less scrolling!
========================================== ==========================================
TMUX COMMAND WINDOW (TAB)
========================================== ==========================================
List tmux ls List ^b w
New new -s <session> Create ^b c
Attach att -t <session> Rename ^b , <name>
Rename rename-session -t <old> <new> Last ^b l (lower-L)
Kill kill-session -t <session> Close ^b &
@mjbommar
mjbommar / r_oracle_jdbc_example1.R
Created November 22, 2012 15:36
Example of connecting to an Oracle database using R and RJDBC
# Set JAVA_HOME, set max. memory, and load rJava library
Sys.setenv(JAVA_HOME='/path/to/java_home')
options(java.parameters="-Xmx2g")
library(rJava)
# Output Java version
.jinit()
print(.jcall("java/lang/System", "S", "getProperty", "java.version"))
# Load RJDBC library
@ksafranski
ksafranski / expecting.md
Last active November 11, 2023 23:00
Basic principles of using tcl-expect scripts

Intro

TCL-Expect scripts are an amazingly easy way to script out laborious tasks in the shell when you need to be interactive with the console. Think of them as a "macro" or way to programmaticly step through a process you would run by hand. They are similar to shell scripts but utilize the .tcl extension and a different #! call.

Setup Your Script

The first step, similar to writing a bash script, is to tell the script what it's executing under. For expect we use the following:

#!/usr/bin/expect
@hggh
hggh / graylog2.md
Last active January 6, 2023 12:18
Graylog2 Debian Packages

WARNING

These packages are obsolete! Please use the official packages from http://www.Graylog2.org

=================================================

@mangecoeur
mangecoeur / concurrent.futures-intro.md
Last active January 9, 2024 16:04
Easy parallel python with concurrent.futures

Easy parallel python with concurrent.futures

As of version 3.3, python includes the very promising concurrent.futures module, with elegant context managers for running tasks concurrently. Thanks to the simple and consistent interface you can use both threads and processes with minimal effort.

For most CPU bound tasks - anything that is heavy number crunching - you want your program to use all the CPUs in your PC. The simplest way to get a CPU bound task to run in parallel is to use the ProcessPoolExecutor, which will create enough sub-processes to keep all your CPUs busy.

We use the context manager thusly:

with concurrent.futures.ProcessPoolExecutor() as executor:
@hsribei
hsribei / can-nat-traversal-be-tor-s-killer-feature.md
Last active July 12, 2018 19:15
Can NAT traversal be Tor's killer feature?

Can NAT traversal be Tor's killer feature?

tl;dr: how about a virtual global flat LAN that maps static IPs to onion addresses?

[We all know the story][1]. Random feature gets unintentionally picked up as the main reason for buying/using a certain product, despite the creator's intention being different or more general. (PC: spreadsheets; Internet: porn; smartphones: messaging.)

@hsw0
hsw0 / 000-README.md
Last active October 18, 2022 07:56
Samba AD + OpenSSH LPK Schema

Samba AD + openssh-lpk Schema

Add openssh-lpk Schema [1] to Samba 4 ad dc.

Usage

sed -i -e 's/${DOMAINDN}/DC=your,DC=domain,DC=name/' *.ldif'
@halberom
halberom / 00_description
Last active April 14, 2022 19:23
ansible - example of using filters to change each item in a list
The problem:
I wanted to use the jinja 'map' filter to modify each item in a string, in this simple
example, adding '.conf' to each item.
The 'format' filter in jinja takes arguments (value, *args, **kwargs). Unfortunately,
it uses 'value' as the pattern. When called inside map 'value' is the current item in
the list, or in other words *args as far as format is concerned. So it's the wrong way
around.