Skip to content

Instantly share code, notes, and snippets.

View MacRusher's full-sized avatar

Maciek Stasiełuk MacRusher

View GitHub Profile
#!/bin/bash
dburl=`meteor mongo --url $1`
echo "mongo dburl:" $dburl
IFS=':' read -a dbdata <<< "$dburl"
IFS='@' read -a dbdata2 <<< "${dbdata[2]}"
IFS='/' read -a dbdata3 <<< "${dbdata[3]}"
M_USER=`echo ${dbdata[1]} | sed 's/\/\///g'`
M_PASSWD=${dbdata2[0]}
M_HOST=${dbdata2[1]}
@MacRusher
MacRusher / codeship.install.meteor.com
Last active May 12, 2016 01:18
Replacement for http://install.meteor.com script that doesn't require sudo and can be used on CodeShip CI
curl -s https://install.meteor.com/ 2>&1 | sed -e "s/type sudo >\/dev\/null 2>&1/\ false /g" | sh
@MacRusher
MacRusher / CustomForm.jsx
Last active June 14, 2017 16:23
Snippets for uniforms blog post
import {Grid} from 'semantic-ui-react';
import {
AutoForm, TextField, LongTextField, RadioField, SubmitField, ErrorsField
} from 'uniforms-semantic';
const CustomForm = () => (
<AutoForm
schema={BlogPostSchema}
onSubmit={(data) => /* you'll probably want to call some prop over here */}
>
@MacRusher
MacRusher / SimpleForm.jsx
Last active June 14, 2017 16:09
Snippets for uniforms blog post
import React from 'react';
import {AutoForm} from 'uniforms-semantic';
const MySimpleForm = () => (
<AutoForm
schema={schema}
onSubmit={(data) => /* handle data when form is submitted */}
/>
);
@MacRusher
MacRusher / schema.js
Created June 14, 2017 15:56
Snippets for uniforms blog post
import {SimpleSchema} from 'meteor/aldeed:simple-schema';
export const BlogPostSchema = new SimpleSchema({
title: {
type: String,
},
authorName: {
type: String,
optional: true,
},
@MacRusher
MacRusher / ValidatedQuickForm.js
Last active June 19, 2017 13:14
uniforms inheritance
import BaseForm from './BaseForm';
import QuickForm from './QuickForm';
import ValidatedForm from './ValidatedForm';
const ValidatedQuickForm = ValidatedForm.Validated(QuickForm.Quick(BaseForm));
@MacRusher
MacRusher / backdate.sh
Created March 13, 2018 10:07
Create backdated SonarQube analysis for a project
#!/usr/bin/env bash
# Prepare list of commit hashes.
# Adjust `since`, `grep` and other switches to your needs.
git log --merges --since=2018-02-01 --grep="(pull request #" --format="%H %ci" |
while read -a vars
do
# Checkout to given commit.
# Must be executed in the target repository, with no working three changes.
git checkout ${vars[0]}
@MacRusher
MacRusher / adb_connect.sh
Last active October 3, 2018 12:13
Enable remote debugging on android device via ADB over TCP/IP
#!/usr/bin/env bash
# List current devices before operation for convenience
# There must be only one device connected or operation will fail
adb devices
# Listen on TCP port
adb tcpip 5555
# Connection may fail operation if done too early, so wait for a while
sleep 5;
# Find out local ip address (this may differ based on network card etc.) and connect via TCP/IP
@MacRusher
MacRusher / exec_in_new_tab.sh
Created October 4, 2018 13:05
Execute commands in multiple terminal tabs
#!/usr/bin/env bash
exec_in_new_tab() {
xdotool key 'ctrl+shift+t';
sleep 1;
for cmd in "$@"
do
xdotool type --delay 1 --clearmodifiers "$cmd";
xdotool key 'Return';
done
@MacRusher
MacRusher / fix-opera.sh
Created June 13, 2023 17:34
Fix for Opera h264 codecs on Ubuntu
#!/usr/bin/env bash
##############################################
# Install lib before using: #
# sudo apt install -y chromium-codecs-ffmpeg #
##############################################
OPERA_PATH=/usr/lib/x86_64-linux-gnu/opera-developer
FFMPEG_PATH=/snap/chromium-ffmpeg/current/chromium-ffmpeg-111306/chromium-ffmpeg/libffmpeg.so