Skip to content

Instantly share code, notes, and snippets.

View yitsushi's full-sized avatar
🏳️‍⚧️

Victoria Nadasdi yitsushi

🏳️‍⚧️
View GitHub Profile
#!/bin/sh
# Basic logic:
# Check if current user is not equal with the file owner
# Parse mysql parameters from app/config/parameters.ini
# Check differeces from origin
# Merge remote changes
# If merge says there is nothing to do then simply exit
# If there was SQL files then execute them
# Updtae Symfony stuffs
@yitsushi
yitsushi / keylength_from_publickey.sh
Created October 19, 2015 19:36
A simple script that calculates the key length from the public key
#!/usr/bin/env bash
keyFile=$1
keyHash=`sed -e 's/^[^ ]* //' ~/.ssh/acquia_rsa.pub | sed -e 's/ .*//'`
comment=`awk '{print $3}' $keyFile`
getHexValue() {
content=$1
from=$2
length=$3
class TestConstMissing
# default value
DEFAULT_VALUE = 0
# self because constants defined on that level
# and not in instances
def self.const_missing(name)
puts "[log] Nope! '#{name}'"
self::DEFAULT_VALUE
@yitsushi
yitsushi / nextGitAutoTagVerion.sh
Created October 22, 2015 14:17
Auto tag working directory before staging. Useful to quick revert if the new codebase failed (build server? Test? use them instead :D).
#!/bin/sh
git fetch --tags && \
git tag | \
grep "autotag-`date +"%Y%m%d"`" > /dev/null \
|| git tag "autotag-`date +"%Y%m%d"`" -m 'autotag' \
&& git tag "autotag-`date +"%Y%m%d"`-"$((`git tag | sort -n | tail -n 1 | sed -Ee 's/autotag-[0-9]{8}-?([0-9]*)/\1/g'` + 1))
@yitsushi
yitsushi / randomPasswordGenerator.sh
Last active October 23, 2015 19:17
Random password generator in bash (and zsh)
# shell logger (if DEBUG = 1)
log() {
if [[ "$DEBUG" = 1 ]]
then
echo " *** [`date +'%x %T'`] $*" >&2
fi
}
# Random password generator
# 1st parameter is the length of the password (15 by default)
FROM alpine
MAINTAINER Balazs Nadasdi <[email protected]>
# Update package index and install go + git
RUN apk add --update go git
# Set up GOPATH
RUN mkdir /go
ENV GOPATH /go
@yitsushi
yitsushi / pre-commit
Created February 9, 2016 14:57
"php -l" before commit
#!/usr/bin/env php
<?php
$files = array();
$returnValue = 0;
$exitStatus = 0;
$acceptedExtensions = array('php');
# git revision
exec('git rev-parse --verify HEAD 2> /dev/null', $files, $returnValue);
@yitsushi
yitsushi / test.rb
Last active May 17, 2016 10:23
Ruby public, protected, private calls
class A
public
def pub_test
puts "A::pub_test"
print " ->"
prot_test
print " ->"
priv_test
end
<?php
function test_permutations_rob($items, $perms = [], &$return = []) {
if (empty($items)) {
$return[] = $perms;
} else {
sort($items);
$prev = false;
for ($i = count($items) - 1; $i >= 0; --$i) {
$newitems = $items;

Keybase proof

I hereby claim:

  • I am yitsushi on github.
  • I am yitsushi (https://keybase.io/yitsushi) on keybase.
  • I have a public key whose fingerprint is 37D5 583D 863D 4312 835C 5C2B CA6D FB19 D2C8 9810

To claim this, I am signing this object: