Skip to content

Instantly share code, notes, and snippets.

View michalczukm's full-sized avatar

Michał Michalczuk michalczukm

View GitHub Profile
@michalczukm
michalczukm / git-pushing-multiple.rst
Created April 10, 2021 14:30 — forked from rvl/git-pushing-multiple.rst
How to push to multiple git remotes at once. Useful if you keep mirrors of your repo.

Pushing to Multiple Git Repos

If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.

Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.

If in doubt about what git is doing when you run these commands, just

@michalczukm
michalczukm / mysql-docker.sh
Created November 25, 2017 19:14 — forked from spalladino/mysql-docker.sh
Backup and restore a mysql database from a running Docker mysql container
# Backup
docker exec CONTAINER /usr/bin/mysqldump -u root --password=root DATABASE > backup.sql
# Restore
cat backup.sql | docker exec -i CONTAINER /usr/bin/mysql -u root --password=root DATABASE
@michalczukm
michalczukm / perfectelementary.bash
Last active November 4, 2023 01:34
HowTo Install the perfect Elementary-OS
# how to install VB guest additions on Elementary OS
# http://www.binarytides.com/install-virtualbox-guest-additions-elementary-os-luna/
#Download Elementary OS from here:
#http://sourceforge.net/projects/elementaryos/files/stable/
#First you update your system
sudo apt-get update && sudo apt-get dist-upgrade
@michalczukm
michalczukm / shamExports.ts
Last active August 26, 2015 20:02 — forked from ArtemAvramenko/shamExports.ts
Shams CommonJS modules
var module: { exports };
var exports = {
sham: (() => {
var sham = <{
(moduleName: string): void;
modules: { [moduleName: string]: { exports } };
}>(moduleName => {
exports = { sham };
module = sham.modules[moduleName] = { exports };
});

Oops! I accidentally deleted a local git branch, and I haven't pushed it to a remote server yet. The branch has several important commits, and it hasn't been merged with any other branches yet. How do I find the missing branch?

1. Create a list of all dangling or unreachable commits.

$ git fsck --full --no-reflogs --unreachable --lost-found
unreachable tree 4a407b1b09e0d8a16be70aa1547332432a698e18
unreachable tree 5040d8cf08c78119e66b9a3f8c4b61a240229259
unreachable tree 60c0ce61b040f5e604850f747f525e88043dae12
unreachable tree f080522d06b9853a2f18eeeb898724da4af7aed9
@michalczukm
michalczukm / knockout-chosen.js
Last active August 29, 2015 14:18 — forked from tomazy/knockout-chosen.js
For TypeScript
ko.bindingHandlers.chosen = {
init: (element, valueAccessor, allBindings, viewModel, bindingContext) => {
var $element = $(element);
var options = ko.unwrap(valueAccessor());
if (typeof options === 'object')
$element.chosen(options);
['options', 'selectedOptions'].forEach(propName => {
if ((<any>allBindings).has(propName)) {