Lost the root/admin password? You can reset it using the command-line. Recipe adapted from gitlab issue #308.
# start the console
sudo gitlab-rails console
Lost the root/admin password? You can reset it using the command-line. Recipe adapted from gitlab issue #308.
# start the console
sudo gitlab-rails console
Commands to compile and load module:
checkmodule -M -m -o gitweb.mod gitweb.te
semodule_package -o gitweb.pp -m gitweb.mod
semodule -i gitweb.pp
Doesn't work on your system?
setenforce 0
# test LDAPS connection using TLS 1.1 and internal CA certificate validation. | |
require 'rubygems' | |
require 'net/ldap' | |
# refs: | |
# https://gist.github.com/jeffjohnson9046/7012167 | |
# https://github.com/ruby-ldap/ruby-net-ldap/blob/master/lib/net/ldap.rb | |
def get_ldap_response(ldap) |
# based on http://stackoverflow.com/questions/6459616/overriding-queryset-delete-in-django | |
class DeactivateQuerySet(models.query.QuerySet): | |
''' | |
QuerySet whose delete() does not delete items, but instead marks the | |
rows as not active, and updates the timestamps | |
''' | |
def delete(self): | |
self.deactivate() |
#!/bin/bash | |
# License: MIT | |
# You can find a copy of the license here: http://opensource.org/licenses/MIT | |
# This simple script lets you change the LDAP admin password from | |
# a console on the LDAP server. | |
cd /tmp | |
set -o errexit | |
PASSWORD=$(slappasswd -h {SSHA}) |
Simple collection of Groovy scripts to help me maintain some Jenkins systems.
See also https://wiki.jenkins-ci.org/display/JENKINS/Jenkins+Script+Console
Please comment & let me know if you have a fork / fixes you'd like to include.
// scan all jobs and check if the last build was aborted (e.g. maintenance) | |
// and output user / timestamp | |
jobs = Jenkins.instance.getAllItems() | |
lastabort = null | |
jobs.each { j -> | |
if (j instanceof com.cloudbees.hudson.plugins.folder.Folder) { return } | |
numbuilds = j.builds.size() | |
if (numbuilds == 0) { return } | |
lastbuild = j.builds[numbuilds - 1] |
// for all builds from build-flow-plugin whose parameters include a GIT_BRANCH paramater, | |
// change the displayName to include branch and build number | |
import com.cloudbees.plugins.flow.*; | |
jobs = Jenkins.instance.getAllItems(BuildFlow); | |
jobs.each { it -> | |
it.builds.each { b -> | |
GIT_BRANCH = b.envVars['GIT_BRANCH'] | |
( GIT_BRANCH =~ /(?:refs\/remotes\/)?(.+)/ ).each { full,branch -> |
class CustomDatabaseCreation(BaseDatabaseCreation): | |
def sql_create_model(self, model, style, known_models=set()): | |
final_output, pending_references = super(CustomDatabaseCreation, self).sql_create_model(model, style, known_models) | |
# get output generated by parent class for unique_together. | |
for field_constraints in opts.unique_together: | |
line = (' ' + style.SQL_KEYWORD('UNIQUE') + ' (%s)' % | |
", ".join( | |
[style.SQL_FIELD(qn(opts.get_field(f).column)) | |
for f in field_constraints])) |
# named_indices/models.py | |
from django.db.backends.schema import BaseDatabaseSchemaEditor | |
old_create_index_name = BaseDatabaseSchemaEditor._create_index_name | |
if not hasattr(BaseDatabaseSchemaEditor, '_old_create_index_name'): | |
setattr(BaseDatabaseSchemaEditor, '_old_create_index_name', old_create_index_name) | |
def _create_index_name(self, model, column_names, suffix=""): | |
try: |