Skip to content

Instantly share code, notes, and snippets.

View bweigel's full-sized avatar
💭
¯\_(ツ)_/¯

Benjamin Genz bweigel

💭
¯\_(ツ)_/¯
View GitHub Profile
@bweigel
bweigel / gist:a0939d1d0d0e193f9163c56c7d9f089f
Created April 20, 2018 12:16
[RedShift] get userpermissions for schemas
SELECT *
FROM
(
SELECT
schemaname
,usename
,HAS_SCHEMA_PRIVILEGE(usrs.usename, schemaname, 'create') AS _create
,HAS_SCHEMA_PRIVILEGE(usrs.usename, schemaname, 'usage') AS _usage
FROM
(
@bweigel
bweigel / wot_linux.md
Last active April 21, 2023 06:22
How to install World of Tanks on Linux

Install World of Tanks on Ubuntu Linux

CURRENTLY NOT WORKING (2017-12-16 9.21)

Introduction

This guide will show you how to install World Of Tanks on Ubuntu Linux (or any flavour such as Xubuntu, Lubuntu, Kubuntu, etc) using Wine+PlayOnLinux.

By the end of the guide you should have a fully working, stable client with HD textures and even functional Alt+Tabbing.

@bweigel
bweigel / set_display_brightness.sh
Last active January 4, 2018 19:15
[LINUX] Change display brightness of all connected screens
#!/bin/bash
BRIGHTNESS=$1
if [[ $(echo "${BRIGHTNESS} >= 0.2 && ${BRIGHTNESS} <= 1" | bc) = 1 ]]; then
for disp in $(xrandr | awk '{print $1,$2}' | grep -P '(?<!dis)connected' | awk '{print $1}'); do
echo "Setting brightness in display ${disp} to ${BRIGHTNESS}..."
xrandr --output $disp --brightness ${BRIGHTNESS}
done
else
@bweigel
bweigel / compress-pdf-with-gs.md
Created December 5, 2017 07:55 — forked from drawveloper/compress-pdf-with-gs.md
Compress PDF files with ghostscript

This can reduce files to ~15% of their size (2.3M to 345K, in one case) with no obvious degradation of quality.

ghostscript -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/printer -dNOPAUSE -dQUIET -dBATCH -sOutputFile=output.pdf input.pdf

Other options for PDFSETTINGS:

  • /screen selects low-resolution output similar to the Acrobat Distiller "Screen Optimized" setting.
  • /ebook selects medium-resolution output similar to the Acrobat Distiller "eBook" setting.
  • /printer selects output similar to the Acrobat Distiller "Print Optimized" setting.
  • /prepress selects output similar to Acrobat Distiller "Prepress Optimized" setting.
@bweigel
bweigel / get_userpermissions_for_schema.sql
Last active May 17, 2018 07:56
Get a view of the Users permission on all tables of a specified schema [Redshift]
SELECT *
FROM
(
SELECT
schemaname
,objectname
,usename
,HAS_TABLE_PRIVILEGE(usrs.usename, fullobj, 'select') AS sel
,HAS_TABLE_PRIVILEGE(usrs.usename, fullobj, 'insert') AS ins
,HAS_TABLE_PRIVILEGE(usrs.usename, fullobj, 'update') AS upd
@bweigel
bweigel / clean_output_from_ipynb.sh
Created July 3, 2017 22:47
Clean Jupyter notebooks from output using jq
#!/bin/bash
cat $1 | jq '. + {"cells": [.cells[] | if .cell_type == "code" then . + {"outputs" : []} else . end]}'