Skip to content

Instantly share code, notes, and snippets.

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

Victoria Nadasdi yitsushi

🏳️‍⚧️
View GitHub Profile
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 / 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)
@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))
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 / 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
#!/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 / wordpress.js
Last active August 29, 2015 14:24
Wordpress archive widget to annually grouped list
jQuery(function() {
var archive = jQuery('.widget_archive li a').toArray().map(function(item) {
var t = item.innerText.split(/ /);
return {
'link': item.getAttribute('href'),
'year': parseInt(t[1], 10),
'month': t[0],
'count': parseInt(item.parentNode.innerText.match(/\(([0-9]+)\)$/)[1], 10)
};
}).reduce(function(memo, item) {
// ... cut
Users.findById(id, function(err, result) {
if (err) {
// OMG! We got an error
return response.redirect('/404.html');
}
// nice we can do something with user
});
// ... cut
#!/usr/bin/env node
var sys = require("sys"),
spawn = require('child_process').spawn;
/*
* htmlEntities function is from Chris Coyier
* URL: http://css-tricks.com/snippets/javascript/htmlentities-for-javascript/
*/
function htmlEntities(str) {
@yitsushi
yitsushi / Makefile
Last active April 15, 2016 11:44
Epic Makefile for Go. (make help for more info)
all: cover build
coverFile := $(shell mktemp -u -t cover.out.XXXXXX)
projectName := $(shell basename `pwd`)
hasGocov := #$(shell which gocov)
packages := $(shell go list ./...)
ifndef OUTPUT
OUTPUT = "text"
endif