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 java.util.ArrayList | |
import hudson.model.*; | |
// Remove everything which is currently queued | |
def q = Jenkins.instance.queue | |
for (queued in Jenkins.instance.queue.items) { | |
q.cancel(queued.task) | |
} | |
// stop all the currently running jobs |
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
# Bash best practices and style-guide | |
Just simple methods to keep the code clean. | |
Inspired by [progrium/bashstyle](https://github.com/progrium/bashstyle) and [Kfir Lavi post](http://www.kfirlavi.com/blog/2012/11/14/defensive-bash-programming/). | |
## Quick big rules | |
* All code goes in a function | |
* Always double quote variables |
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 java.util.ArrayList; | |
import hudson.model.*; | |
def q = Jenkins.instance.queue | |
for (queued in Jenkins.instance.queue.items) { | |
q.cancel(queued.task) | |
} | |
for (job in Jenkins.instance.items) { | |
stopJobs(job) |
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
# Source: https://gist.github.com/vfarcic/78c1d2a87baf31512b87a2254194b11c | |
############################################################### | |
# How To Create A Complete Internal Developer Platform (IDP)? # | |
# https://youtu.be/Rg98GoEHBd4 # | |
############################################################### | |
# Additional Info: | |
# - DevOps MUST Build Internal Developer Platform (IDP): https://youtu.be/j5i00z3QXyU | |
# - How To Create A "Proper" CLI With Shell And Charm Gum: https://youtu.be/U8zCHA-9VLA |
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
0. SSH to server | |
1. Edit /opt/bitnami/apps/jenkins/jenkins_home/config.xml | |
2. set userSecurity to false: <userSecurity>false</userSecurity> | |
3. delete | |
<authorizationStrategy> and <securityRealm> | |
4. /etc/init.d/bitnami restart |
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
#!/usr/bin/env bash | |
# seems to work on any filesystem | |
# final size is (bs * seek) in bytes | |
# this creates a 4MB sparse file | |
dd if=/dev/zero of=/tmp/file bs=1 count=0 seek=4194304 | |
# or |
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 os | |
import sys | |
import uuid | |
import boto3 | |
import tweepy | |
from urllib.parse import unquote_plus | |
# Twitter authentication variables | |
consumer_key = os.environ.get('TWITTER_CONSUMER_KEY', 'ap-northeast-1') | |
consumer_secret = os.environ.get('TWITTER_CONSUMER_SECRET', 'ap-northeast-1') |
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
command line used: (need to change username and password) | |
curl -k -u [USERNAME]:[PASSWORD] -X PUT -H "Content-Type:application/json" -H "Accept:application/json" -d '{"host":{"subnet_id":null,"serial":null,"puppetproxy_id":null,"name":"cittavld10.globoi.com","managed":null,"last_report":null,"comment":"","architecture_id":1,"created_at":"2011-10-10T17:46:30Z","sp_mac":"","puppetmaster_name":"puppet-lab.dev.globoi.com","image_file":null,"updated_at":"2012-02-29T14:41:29Z","sp_name":"","mac":"00:16:3e:16:69:b8","installed_at":null,"domain_id":2,"use_image":null,"root_pass":"xybxa6JUkz63w","owner_id":2,"medium_id":null,"id":896,"hostgroup_id":null,"enabled":true,"build":false,"ptable_id":null,"sp_subnet_id":null,"puppet_status":0,"last_freshcheck":null,"ip":"127.0.01","environment_id":2,"source_file_id":null,"model_id":1,"environment":{"environment":{"name":"lab2","id":2}},"sp_ip":"","disk":null,"owner_type":"User","operatingsystem_id":5,"last_compile":"2011-08-21T04:02:27Z"}}' http://localhost:3000/hosts/citta |
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 requests | |
import logging | |
import httplib | |
# Debug logging | |
httplib.HTTPConnection.debuglevel = 1 | |
logging.basicConfig() | |
logging.getLogger().setLevel(logging.DEBUG) | |
req_log = logging.getLogger('requests.packages.urllib3') | |
req_log.setLevel(logging.DEBUG) |
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
AWS_ROOT_CA_FILE=$HOME/aws.root.ca.bundle.pem | |
cp /dev/null $AWS_ROOT_CA_FILE | |
for ca in \ | |
https://www.amazontrust.com/repository/AmazonRootCA1.pem \ | |
https://www.amazontrust.com/repository/AmazonRootCA2.pem \ | |
https://www.amazontrust.com/repository/AmazonRootCA3.pem \ | |
https://www.amazontrust.com/repository/AmazonRootCA4.pem \ | |
https://www.symantec.com/content/en/us/enterprise/verisign/roots/VeriSign-Class%203-Public-Primary-Certification-Authority-G5.pem; do |
NewerOlder