Skip to content

Instantly share code, notes, and snippets.

View pgaertig's full-sized avatar

Piotr Gaertig pgaertig

View GitHub Profile
# iptables-save
# Generated by iptables-save v1.8.7 on Sun Dec 18 17:35:25 2022
*filter
:INPUT ACCEPT [0:0]
:FORWARD DROP [0:0]
:OUTPUT ACCEPT [0:0]
:DOCKER - [0:0]
:DOCKER-ISOLATION-STAGE-1 - [0:0]
:DOCKER-ISOLATION-STAGE-2 - [0:0]
:DOCKER-USER - [0:0]
@pgaertig
pgaertig / transpose_table.js
Created April 13, 2012 13:48
Transpose HTML table using jQuery
$(function() {
var t = $('#thetable tbody').eq(0);
var r = t.find('tr');
var cols= r.length;
var rows= r.eq(0).find('td').length;
var cell, next, tem, i = 0;
var tb= $('<tbody></tbody>');
while(i<rows){
cell= 0;
@pgaertig
pgaertig / FactoryGrill.groovy
Last active June 15, 2019 04:09
FactoryGrill - db population made easy - a-la FactoryGirl
import groovy.sql.Sql
import org.codehaus.groovy.control.CompilerConfiguration
import java.sql.Connection
class FactoryGrill extends Script {
private Connection connection;
private Sql sql;
import javax.xml.bind.annotation.adapters.HexBinaryAdapter;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.security.MessageDigest;
public class Main {
public static void main(String[] args) {
System.out.printf("JKuferek 1.0");
@pgaertig
pgaertig / Dockerfile
Created April 4, 2018 20:28
KP Dockerfile
FROM debian:stretch-slim
ENV RAILS_ENV=production TERM=xterm
ADD Gemfile Gemfile.lock package.json /home/app/
RUN (echo "deb http://deb.debian.org/debian/ stretch non-free contrib" >> /etc/apt/sources.list) && \
apt-get -qq update && \
apt-get install -y --no-install-recommends gnupg2 ca-certificates git curl ruby2.3 ruby-dev build-essential \
libpq-dev libpq5 libxml2 zlib1g-dev dumb-init libfontconfig ttf-mscorefonts-installer procps bzip2 && \
(curl -sL https://deb.nodesource.com/setup_8.x | bash - ) && \
gem install bundler --no-ri --no-rdoc && \
groupadd -g 1000 -o app && \
@pgaertig
pgaertig / 99-vfat-media-automount.rules
Created July 8, 2017 21:39
Ubuntu experiment to automount VFAT partitions without marking files with executable permission (fmask)
# vim:enc=utf-8:nu:ai:si:et:ts=4:sw=4:ft=udevrules:
#
# /etc/udev/rules.d/99-vfat-media-automount.rules
KERNEL!="sd[b-z]*", GOTO="vfat-media-automount_end"
IMPORT{program}="/sbin/blkid -o udev -p %N"
ENV{ID_FS_TYPE}!="vfat", GOTO="vfat-media-automount_end"
ENV{ID_FS_LABEL}!="", ENV{dir_name}="%E{ID_FS_LABEL}"
ENV{ID_FS_LABEL}=="", ENV{dir_name}="usbhd-%k"
@pgaertig
pgaertig / ansible.cfg
Created November 23, 2016 08:19
Ansible config for local directory inventory with faster SSH pipelining
[defaults]
inventory = ./hosts
[ssh_connection]
pipelining = True
@pgaertig
pgaertig / install_docker.yaml
Last active November 23, 2016 08:16
Install Docker with registry on Debian server with Ansible
- hosts: myserver
tasks:
- name: Enable backports
apt_repository: filename="backports" repo="deb http://http.debian.net/debian jessie-backports main"
- name: Add apt http support
apt: name=apt-transport-https,ca-certificates
- name: Add docker repo key
apt_key: keyserver=hkp://p80.pool.sks-keyservers.net:80 id=58118E89F3A912897C070ADBF76221572C52609D
@pgaertig
pgaertig / base64shim.js
Created September 14, 2013 22:12
Base64 (btoa/atob) shim adapted for WebKit's Web Workers, which miss these functions. See https://bugs.webkit.org/show_bug.cgi?id=55663
// Source: http://code.google.com/p/gflot/source/browse/trunk/flot/base64.js?r=153
/* Copyright (C) 1999 Masanao Izumo <iz@onicos.co.jp>
* Version: 1.0
* LastModified: Dec 25 1999
* This library is free. You can redistribute it and/or modify it.
*/
/*
* Interfaces:
@pgaertig
pgaertig / development.rb
Created December 2, 2012 22:36
Dogslow like functionality for Rack and Rails
#Add this to your development.rb
config.middleware.use DogslowRack