Skip to content

Instantly share code, notes, and snippets.

Avatar

momoterraw andrewvmail

  • Vancouver
View GitHub Profile
View samizdat-shell-help.bash
#!/bin/bash
###
### my-script — does one thing well
###
### Usage:
### my-script <input> <output>
###
### Options:
### <input> Input file to read.
### <output> Output file to write. Use '-' for stdout.
@andrewvmail
andrewvmail / Catalina_ISO.sh
Last active Apr 5, 2020 — forked from Kutkovsky/Catalina_ISO.sh
The steps allowing to create macOS 10.15 Catalina VM on vSphere or ESXi
View Catalina_ISO.sh
#!/bin/bash
# Added after beta and doing it at a catalina machine.
# App Store > macOS Catalina > GET
# Steps to create the macOS Catalina (10.15) VM:
# login to developer.apple.com or beta.apple.com to download a tester's profile for your OS. Install it.
# Go to System Preferences > Software Update and start the update process
# When the Catalina Installer (few MBytes) is started, it downloads the remain part of installation.
@andrewvmail
andrewvmail / index.js
Created Mar 29, 2020 — forked from NoTimeForHero/index.js
NodeJS script to remove 1000 DNS records added by Cloudflare when used * (wildcard) A record
View index.js
// Now if you adding a domain with wildcard A record, Cloudflare uses strange scan, which added a 1000 trash domains (like 1-100, some english words like "ai", "air", "android").
// There's no way to bulk delete it, you can delete it only using their API.
// So I write a script that can help you with this problem.
// Discussions about same problem:
// https://community.cloudflare.com/t/delete-all-records-using-api/13410/2
// https://community.cloudflare.com/t/bulk-delete-dns-record/89540
const settings = {
email: 'your@email',
@andrewvmail
andrewvmail / openssl-build.sh
Created Jan 2, 2020 — forked from foozmeat/openssl-build.sh
A shell script to build openssl for iOS and Mac. It currently builds: Mac -> i386 & x86_64 // iOS -> armv7, arm64 // iOS Simulator -> i386 & x86_64.
View openssl-build.sh
#!/bin/bash
# This script builds the iOS and Mac openSSL libraries
# Download openssl http://www.openssl.org/source/ and place the tarball next to this script
# Credits:
# https://github.com/st3fan/ios-openssl
# https://github.com/x2on/OpenSSL-for-iPhone/blob/master/build-libssl.sh
@andrewvmail
andrewvmail / build.gradle
Created Jul 3, 2019 — forked from tprochazka/build.gradle
Smart versionName and versionCode for android Gradle build evaluation
View build.gradle
/**
* Will return version from properties file and replace -SNAPSHOT by GIT commit hash
* to recognize origin commit for the every build.
*/
project.ext.evalVersionName = {
def ideBuild = project.properties['android.injected.invoked.from.ide']
if (ideBuild) {
logger.info("IDE build");
return "dev"
} else if (project.VERSION.toUpperCase().contains("SNAPSHOT")) {
@andrewvmail
andrewvmail / interval.js
Created Jun 26, 2019 — forked from manast/interval.js
Accurate Javascript setInterval replacement
View interval.js
function interval(duration, fn){
this.baseline = undefined
this.run = function(){
if(this.baseline === undefined){
this.baseline = new Date().getTime()
}
fn()
var end = new Date().getTime()
this.baseline += duration
@andrewvmail
andrewvmail / combining-git-repositories.md
Created Jun 26, 2019 — forked from msrose/combining-git-repositories.md
How to combine two git repositories.
View combining-git-repositories.md

Combining two git repositories

Use case: You have repository A with remote location rA, and repository B (which may or may not have remote location rB). You want to do one of two things:

  • preserve all commits of both repositories, but replace everything from A with the contents of B, and use rA as your remote location
  • actually combine the two repositories, as if they are two branches that you want to merge, using rA as the remote location

NB: Check out git subtree/git submodule and this Stack Overflow question before going through the steps below. This gist is just a record of how I solved this problem on my own one day.

Before starting, make sure your local and remote repositories are up-to-date with all changes you need. The following steps use the general idea of changing the remote origin and renaming the local master branch of one of the repos in order to combine the two master branches.

@andrewvmail
andrewvmail / 00-about-search-api-examples.md
Created Jun 13, 2019 — forked from jasonrudolph/00-about-search-api-examples.md
5 entertaining things you can find with the GitHub Search API
View 00-about-search-api-examples.md
@andrewvmail
andrewvmail / mysql_secure.sh
Last active May 21, 2019 — forked from Mins/mysql_secure.sh
Automating mysql_secure_installation
View mysql_secure.sh
#!/bin/bash
set -x
SECURE_MYSQL=$(expect -c "
set timeout 10
spawn mysql_secure_installation
expect \"Would you like to setup VALIDATE PASSWORD plugin?\"
send \"n\r\"
expect \"New password:\"
@andrewvmail
andrewvmail / decimalize_git_hash.bash
Created Oct 15, 2018 — forked from hborders/decimalize_git_hash.bash
Print the given git hash + a prepended "1" in decimal form
View decimalize_git_hash.bash
#!/bin/bash -euo pipefail
if [ ${#} -eq 0 ]
then
# read from STDIN
MAYBE_GIT_HASH=$( cat )
else
MAYBE_GIT_HASH="${1}"
fi