Skip to content

Instantly share code, notes, and snippets.

View kaloprominat's full-sized avatar

Pavel Kondratev kaloprominat

View GitHub Profile
@kaloprominat
kaloprominat / git: replace remove override tag bash
Created April 8, 2019 18:08
git: replace remove override tag bash
git tag -d <tagname>
git push origin :refs/tags/<tagname>
git tag -f <tagname>
git push origin master --tags
@kaloprominat
kaloprominat / bash: xor encrypt decrypt string with passphrase
Created March 28, 2018 09:40
bash: xor encrypt decrypt string with passphrase
#!/bin/bash
# requirements:
#
# md5
# cut
# tr
# base64
#
@kaloprominat
kaloprominat / currentBuildIsSeed.py
Created November 3, 2017 12:00 — forked from Piker-Alpha/currentBuildIsSeed.py
Check for Beta build on macOS 10.10 and greater
#!/usr/bin/python
import objc
from Foundation import NSBundle, NSClassFromString
SeedingBundle = NSBundle.bundleWithPath_('/System/Library/PrivateFrameworks/Seeding.framework')
objc.loadBundleFunctions(SeedingBundle, globals(), [("currentBuildIsSeed", '@')])
buildInfo = NSClassFromString('SDBuildInfo')
@kaloprominat
kaloprominat / catalogUtilities.py
Created November 3, 2017 12:00 — forked from Piker-Alpha/catalogUtilities.py
Show and set the CatalogURL on macOS 10.10 and greater
#!/usr/bin/python
import objc
from Foundation import NSBundle, NSClassFromString
SeedingBundle = NSBundle.bundleWithPath_('/System/Library/PrivateFrameworks/Seeding.framework')
functions = [
('currentCatalog', '@'),
@kaloprominat
kaloprominat / mac os x: bash software update change beta catalog
Created October 18, 2017 11:52
mac os x: bash software update change beta catalog
softwareupdate --clear-catalog
Enabling is a bit more tricky, because you need to choose your channel/source. The options are:
OS X Public Beta
sudo softwareupdate --set-catalog https://swscan.apple.com/content/catalogs/others/index-10.12beta-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz
OS X Developer Beta catalog
sudo softwareupdate --set-catalog https://swscan.apple.com/content/catalogs/others/index-10.12seed-10.12-10.11-10.10-10.9-mountainlion-lion-snowleopard-leopard.merged-1.sucatalog.gz
@kaloprominat
kaloprominat / mac os: run macbook firmware updater create package
Created September 21, 2017 10:36
mac os: run macbook firmware updater create package
Procedure followed by Pepijn to run the high sierra firmware installer:
1. get the FirmwareUpdate.pkg file from the OS installer app's installESD.dmg
2. extract the contents using pkgutil --expand FirmwareUpdate.pkg <path somewhere>/FirmwareUpdate
3. in terminal, cd to the Scripts directory inside the expanded firmwareupdate pkg.
4. with Scripts as your working directory, run these 2 commands, then reboot:
/usr/libexec/FirmwareUpdateLauncher -p "$PWD/Tools"
/usr/libexec/efiupdater -p "$PWD/Tools/EFIPayloads"
5. at the reboot, firmware will be updated if there are any updates to be applied.
@kaloprominat
kaloprominat / bash mysql: percona xtrabackup innobackupex backup slave
Created September 8, 2017 14:30
bash mysql: percona xtrabackup innobackupex backup slave
innobackupex --slave-info --databases=db ./
@kaloprominat
kaloprominat / mac os x: parse extract read cat decode mobile mobileprovision provision file
Created March 9, 2017 14:09
mac os x: parse extract read cat decode mobile mobileprovision provision file
security cms -D -i path_to_mobileprovision
@kaloprominat
kaloprominat / linux: resize reduce shrink lvm lxc container size
Last active February 3, 2017 09:22
linux: resize reduce shrink lvm lxc container size
# resize LXC by lxctl
lxctl set <container> --rootsz 150g
# or
lxctl stop <container>
e2fsck -f /dev/vg00/container
@kaloprominat
kaloprominat / linux: bash add swap file memory linux ubuntu
Created September 14, 2016 17:41
linux: bash add swap file memory linux ubuntu
How To Add Swap on Ubuntu 14.04
Posted Apr 28, 2014 532.2k views Getting Started Linux Basics Server Optimization Ubuntu
Introduction
One of the easiest way of increasing the responsiveness of your server and guarding against out of memory errors in your applications is to add some swap space. Swap is an area on a hard drive that has been designated as a place where the operating system can temporarily store data that it can no longer hold in RAM.
Basically, this gives you the ability to increase the amount of information that your server can keep in its working "memory", with some caveats. The space on the hard drive will be used mainly when space in RAM is no longer sufficient for data.
The information written to disk will be slower than information kept in RAM, but the operating system will prefer to keep running application data in memory and use swap for the older data. Overall, having swap space as a fall back for when your system's RAM is depleted is a good safety net.