Skip to content

Instantly share code, notes, and snippets.

@cobaohieu
cobaohieu / fix-os-upgrade.md
Last active May 10, 2024 15:47
fix Your python3 install is corrupted. Please fix the '/usr/bin/python3' symlink.

sudo apt install --reinstall python3

sudo apt install --reinstall python

`` sudo update-alternatives --remove-all python

@troyfontaine
troyfontaine / readme.md
Last active April 8, 2024 06:10
Resize root partition (or how to remove the default /home partition) on CentOS 7 online

Resize root partition (or how to remove the default /home partition) on CentOS 7 online

This process requires that you are able to ssh OR log in locally using the root user account and that no services be running as users out of /home on the target machine.

The examples are from a default installation with no customization-you NEED to know what you're working with for volumes/partitions to not horribly break things.

By default, CentOS 7 uses XFS for the file system and Logical Volume Manager (LVM), creating 3 partitions: /,/home and swap.

NOTE: If you want to be sure that nothing is writing to /home you can either modify the host to boot into single-user mode OR try to use the systemctl isolate runlevel1.target command to switch (not tested! should work).

@fotinakis
fotinakis / Jenkins auto-shudown-slaves job
Last active July 6, 2020 08:56
Auto-managed Jenkins slaves on Google Compute Engine
#!/bin/bash
# Have to redirect stderr to stdout here because slave.py uses stderr for output.
~/bin/slave.py list 2>&1 >/dev/null | grep beaker-slave- | while read slave; do
echo
echo "Checking status of $slave..."
# First, check if we can SSH into the host. If we can, then check the process and maybe shut down.
# This makes sure that we don't consider an SSH failure to be reason to shut down the node.
if ssh $slave echo < /dev/null; then
@mbbx6spp
mbbx6spp / README.md
Last active December 21, 2023 05:05
Gerrit vs Github for code review and codebase management

Gerrit vs Github: for code review and codebase management

Sure, Github wins on the UI. Hands down. But, despite my initial annoyance with Gerrit when I first started using it almost a year ago, I am now a convert. Fully. Let me tell you why.

Note: This is an opinionated (on purpose) piece. I assume your preferences are like mine on certain ideas, such as:

  • Fast-forward submits to the target branch are better than allowing merge commits to the target branch. The reason I personally prefer this is that, even if a non-conflicting merge to the target branch is possible, the fact that the review/pull request is not up to date with the latest on the target branch means feature branch test suite runs in the CI pipeline reporting on the review/PR may not be accurate. Another minor point is that forced merge commits are annoying as fuck (opinion) and clutter up Git log histories unnecessarily and I prefer clean histories.
  • Atomic/related changes all in one commit is something worth striving for. Having your dev
@ekinertac
ekinertac / nginx.conf
Created May 6, 2013 10:37
nginx: port forwarding
server{
listen 80;
server_name example.com;
access_log /home/path_to_site/access.log;
error_log /home/path_to_site/error.log;
location / {
proxy_pass http://0.0.0.0:8002;
proxy_set_header Host $host;
@kendellfab
kendellfab / versionswitch.sh
Created July 14, 2012 15:35
Bash script for changing version code and version name in an android manifest.
MANIFEST_FILE='AndroidManifest.xml'
VERSIONCODE=`grep versionCode $MANIFEST_FILE | sed 's/.*versionCode="//;s/".*//'`
VERSIONNAME=`grep versionName $MANIFEST_FILE | sed 's/.*versionName="//;s/\.[0-9]*".*//'`
NEWCODE=$BUILD_NUMBER
NEWNAME=$VERSIONNAME.$BUILD_NUMBER
echo "Updating Android build information. New version code: $NEWCODE - New version name: $NEWNAME";
sed -i 's/versionCode *= *"'$VERSIONCODE'"/versionCode="'$NEWCODE'"/; s/versionName *= *"[^"]*"/versionName="'$NEWNAME'"/' $MANIFEST_FILE
@asmallteapot
asmallteapot / init_nginx.sh
Created January 18, 2012 15:20
Init scripts for Nginx and uWSGI on Ubuntu 11.10
#! /bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon