Skip to content

Instantly share code, notes, and snippets.

View pwittchen's full-sized avatar
🎯
Focusing

Piotr Wittchen pwittchen

🎯
Focusing
View GitHub Profile
/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@serkanh
serkanh / gist:23c73bdb1fc294ee9105f33ccc1f304e
Created November 14, 2016 19:20
Save tmux session via ascii cinema
asciinema rec -c "tmux attach -t 3"
@sniper7kills
sniper7kills / ELK-install.sh
Last active February 7, 2020 02:13
ELK-Install-Ubuntu-16.04
#/bin/bash
#Ask some info
echo -n "Enter ELK Server IP or FQDN: "
read eip
echo -n "Enter Admin Web Password: "
read adpwd
#Update System
sudo apt-get update
sudo apt-get upgrade -y
@conoro
conoro / hexo2hugo.sh
Created July 10, 2016 09:55
Hexo to Hugo converter
# code is from http://helw.net/2015/07/19/migrating-to-hugo-from-hexo/
# Ran fine on Windows 10 with MSysGit installed
# cd to directory with all the md files from Hexo
# bash hexo2hugo.sh
---
# ensure dates don't start with single quotes
for file in *; do awk '{
if ($1 == "date:") {
gsub("\047", "", $0); print;
} else {
@jarun
jarun / Travis CI local install
Created June 5, 2016 19:00
How to install Travis CI locally on Ubuntu 16.04
sudo apt install ruby ruby-dev
sudo gem install travis
# install path: /var/lib/gems/
@elliotchance
elliotchance / brainfuck.py
Created January 19, 2016 11:52
Write Your Own Brainfuck Compiler
import sys
import ply.yacc as yacc
import ply.lex as lex
tokens = (
'INCREMENT',
'DECREMENT',
'SHIFT_LEFT',
'SHIFT_RIGHT',
'OUTPUT',
@JakeWharton
JakeWharton / Java6.java
Last active May 28, 2022 16:14
A comparison between non-capturing and capturing expressions across Java 6, Java 8, Java 8 with Retrolambda, Kotlin with native function expressions, and Kotlin with Java SAM expression.
import java.util.Arrays;
class NonCapturing {
public static void main(String... args) {
run(new Runnable() {
@Override public void run() {
System.out.println("Hey!");
}
});
}
@jnwhiteh
jnwhiteh / Array.java
Created January 6, 2016 22:15
An example of implementing Iterable and Iterator in Java
import java.util.Iterator;
import java.util.NoSuchElementException;
// Introduction:
//
// This is an example class meant to illustrate several differen concepts:
// * The use of type parameters (i.e. Java generics)
// * Implementing an iterator over some collection, in this case an array
// * Implementing the Iterable interface, which enables your collection
// to work with the Java simple for loops, i.e. (for String s : list)
# Reference:
https://www.cloudgear.net/blog/2015/5-minutes-kubernetes-setup/
# install homebrew and cask
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# install virtualbox
brew cask install virtualbox
# install dockertoolbox
@spalladino
spalladino / mysql-docker.sh
Created December 22, 2015 13:47
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