This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @package Joomla.Plugin | |
* @subpackage Captcha | |
* | |
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved. | |
* @license GNU General Public License version 2 or later; see LICENSE.txt | |
* @note Sorry for the ugliness, just a quick patch to make this work with the 2.0 API, it also connects through TLS now. Just replace original plugins/captcha/recaptcha/recaptcha.php | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function _shell_char { | |
if [ "$_EXIT_CODE" -eq 0 ]; then | |
#printf "%s" "$" | |
printf "$RED$shellchar$RESET" | |
else | |
# printf "$RED$FancyX$RESET" | |
printf "$RED$collision$RESET" | |
fi | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'test/unit' | |
# Read about the problem and mathematical proof here: | |
# http://www.greenteapress.com/thinkbayes/html/thinkbayes002.html#sec15 | |
class MontyHall | |
include Test::Unit::Assertions | |
NUM_DOORS = 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# echo server | |
Socket.udp_server_loop(4444) do |data, src| | |
src.reply data | |
end | |
# client | |
addr = Socket.sockaddr_in(4444, "localhost") | |
socket = Socket.new(:INET, :DGRAM) | |
begin | |
socket.send("hello\n", 0) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=FAHClient cruncher | |
After=syslog.target network.target | |
[Service] | |
Type=simple | |
User=fahclient | |
WorkingDirectory=/var/lib/fahclient | |
EnvironmentFile=-/etc/sysconfig/fahclient | |
# log will go fahclient home dir |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
com.cloudbees.plugins.credentials.SystemCredentialsProvider.getInstance().getCredentials().forEach{ | |
it.properties.each { prop, val -> | |
if (prop == "secretBytes") { | |
println(prop + "=>\n" + new String(com.cloudbees.plugins.credentials.SecretBytes.fromString("${val}").getPlainData()) + "\n") | |
} else { | |
println(prop + ' = "' + val + '"') | |
} | |
} | |
println("-----------------------") | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# the above works with synaps driver | |
DEV="SynPS/2 Synaptics TouchPad" | |
# DEV="Synaptics TM3053-006" | |
toggle_touchpad () { | |
local enabled=`xinput list-props "$DEV" | awk '/Device Enabled/{ print $4 }'` | |
case "$enabled" in | |
0) xinput enable "$DEV" | |
;; | |
1) xinput disable "$DEV" | |
;; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
job = Jenkins.getInstance().getItem("Flexy-install") | |
println job.getProperty(ParametersDefinitionProperty.class)?.getParameterDefinition("REPOSITORIES")?.getDefaultParameterValue() | |
/* | |
License: https://en.wikipedia.org/wiki/WTFPL | |
Some readers: | |
https://support.cloudbees.com/hc/en-us/articles/226941767-Groovy-to-list-all-jobs | |
https://medium.com/@mukeshsingal/update-default-values-of-jenkins-job-parameters-416de5ff9f96 | |
https://javadoc.jenkins.io/hudson/model/Job.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'json' | |
require 'uri' | |
require 'csv' | |
# too bad we lack variable size lookbehind | |
bytes_re = /((?:\\\\)+|[^\\])(?:\\u[0-9a-f]{4})+/ | |
friends_txt = File.read('friends.json').gsub(bytes_re) do |bad_unicode| | |
$1 + eval(%Q{"#{bad_unicode[$1.size..-1].gsub('\u00', '\x')}"}).to_json[1...-1] | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import jenkins.model.Jenkins | |
def numCancels = 0; | |
Jenkins.instance.getAllItems(Job.class).each{ | |
def job = it | |
for (build in job.builds) { | |
if (build.isBuilding()) { build.doStop(); numCancels++; } | |
} | |
} |