Skip to content

Instantly share code, notes, and snippets.

View approximatenumber's full-sized avatar
🥝

Maksim Melnikov approximatenumber

🥝
View GitHub Profile
@approximatenumber
approximatenumber / download_jdk.sh
Last active December 8, 2016 09:03 — forked from sr75/wget-jdk-oracle-install-example.txt
wget command to install Oracle JAVA JDK from stupid oracle website
#!/bin/bash
################################################################################
##
## Title: Oracle Java Installer
##
## Date: 03/27/2015
## Author: Mike G. aka metalcated and partially forked from n0ts
## Version: 0.2
##
################################################################################
@approximatenumber
approximatenumber / update_mozilla_flashplayer.sh
Last active July 4, 2016 20:24
Download a new version of flashplayer and move it in mozilla dir.
#!/bin/bash
set -a
player="libflashplayer.so"
work_dir="/tmp/flash_update"
mozilla_dir="$HOME/.mozilla/plugins"
download_player() {
tarball="install_flash_player_11_linux.x86_64.tar.gz"
wget -nc "https://fpdownload.macromedia.com/get/flashplayer/current/licensing/linux/$tarball"
@approximatenumber
approximatenumber / sqlite2mysql.sh
Created October 20, 2016 08:50
Bash script to migrate from a SQLite database to a MySQL database
#!/bin/bash
## Bash script to migrate from a SQLite database to a MySQL database
## based on vidalon/migrate_sqlite_to_mysql.sh (https://gist.github.com/vidalon/2961155)
## Change VARIABLES to yours to execute the script
SQLITE_SDB_FILE=/tmp/weewx.sdb
SQLITE_FILE=/tmp/swallow.sql
MYSQL_USER=weewx
MYSQL_DATABASE=weewx
@approximatenumber
approximatenumber / slink2hlink.sh
Last active March 22, 2017 15:10
Move all symbolic links to hard links
@approximatenumber
approximatenumber / ldapist.sh
Last active June 26, 2018 09:44
Simple 'ldapsearch' bash wrapper for searching user info in LDAP/AD
#!/bin/bash
# LDAP-server
host="ldap.example.org"
# User for auth
user="CN=YourUser,CN=Users,DC=ldap,DC=example,DC=org"
# Password of User
pass="YourPass"
# LDAP base name
base_name="OU=WhereToSearch,DC=ldap,DC=example,DC=org"
@approximatenumber
approximatenumber / update_jenkins_plugins.Jenkinsfile
Last active October 19, 2017 14:13
Automatically update Jenkins plugins from pipeline job every week
#!/usr/bin/env groovy
def jenkins_cli = "/var/jenkins_home/war/WEB-INF/jenkins-cli.jar"
def jenkins_url = "http://127.0.0.1:8080/"
def admin_email = "admin@domain.com"
def credentials = "--username \"someuser\" --password \"somepass\""
node {
properties(
[
@approximatenumber
approximatenumber / svn2bitbucket.sh
Created June 26, 2018 09:37
Bash script to migrate SVN repo to Git (Bitbucket)
#!/bin/bash
project_name="my-project"
# Full path to your svn repo or path in repo
svn_repo="https://server.svn/repos/my-project"
trunk_path="/trunk"
tags_path="/tags"
branches_path="/branches"
default_email_suffix="@my.company"
git_repo="ssh://git@bitbucket.git:7999/my-project.git"
@approximatenumber
approximatenumber / commits-migrate.sh
Created September 13, 2018 14:01
Another way to dump amd load path of SVN repo: creating empty repo, commiting needed commits and update props
#!/bin/bash
# set empty repo with enabled pre-revprop-change hook
# set first last revisions to dump and migrate
first_rev='1'
last_rev='15'
# range of revisions of old repo to migrate
revs="$(svn log -q -r$first_rev:$last_rev | grep -oE '^r[0-9]+' | tr -d 'r' | sort -n)"
@approximatenumber
approximatenumber / gist:4609dad5d3c63b4ea29d335acb8bb622
Created November 19, 2018 14:05
To remember: open PRs in Bitbucket from Jenkins job
#!/usr/bin/env groovy
payload = """
{
"title": "Updating Toolchain",
"description": "Need to deploy new versions of toolchain after succesful build.",
"state": "OPEN",
"open": true,
"closed": false,
"fromRef": {
@approximatenumber
approximatenumber / suspend-when-lid-is-closed.sh
Created March 26, 2019 12:44
Small script to suspend your laptop when lid is closed
#!/bin/bash
# Add this script to crontab:
# * * * * * username suspend-when-lid-is-closed.sh
if grep -q closed /proc/acpi/button/lid/LID0/state; then
echo "lid is closed, suspending..." > /tmp/suspend-when-lid-is-closed.log
systemctl suspend
fi