Skip to content

Instantly share code, notes, and snippets.

View orymate's full-sized avatar

Máté Őry orymate

  • Budapest, Hungary
  • 08:16 (UTC +02:00)
View GitHub Profile
@orymate
orymate / pass.md
Created April 22, 2015 11:24
Password-store (pass)

This repository contains the database of password-store used by our Team to store passwords (mostly to be used in emergencies).

The database is encrypted for the PGP keys of all members, and can be read and written by any standard PGP implementation.

pass

The preferred tool to manage these passwords is

swap-more-than-1g:
cmd.run:
- name: |
needed=$(awk '/SwapTotal/ {print 1025*1024 - int($2)}' /proc/meminfo)
dd if=/dev/zero of=/var/tmp/swap bs=1K count=$needed
mkswap /var/tmp/swap
echo "/var/tmp/swap none swap sw" >>/etc/fstab
swapon -a
- unless: "awk '/SwapTotal/ {exit int($2) < 1024*1024}' /proc/meminfo"
@orymate
orymate / lock.sh
Created June 30, 2014 15:17
lock.sh
#!/bin/bash
scrot /tmp/screen_locked.png
convert /tmp/screen_locked.png -scale 20% -scale 500% /tmp/screen_locked2.png
i3lock -i /tmp/screen_locked2.png
def method_cache(seconds=0):
"""
A `seconds` value of `0` means that we will not memcache it.
If a result is cached on instance, return that first. If that fails, check
memcached. If all else fails, run the method and cache on instance and in
memcached.
** NOTE: Methods that return None are always "recached".
Based on https://djangosnippets.org/snippets/2477/
@orymate
orymate / clrscr.h
Created November 11, 2013 09:40
Crossplatform megoldás Windows alá és Curses-szel képernyő törlésére és puffereletlen beolvasásra getch-val. Fordítás Windowson a szokásos módon, ncurses esetén pl. `gcc -DUSE_CURSES foobar.c -lncurses`. Képernyő törlése: `clearscreen;`. Az int getch() függvény használatához a main függvény elején szerepeljen egy `init_getch;` parancs.
#ifndef CLRSCR_H
#define CLRSCR_H
#include <stdio.h>
/* Curses használata esetén: */
#ifdef USE_CURSES
#include <curses.h>
#include <stdlib.h>
void endwin2()
@orymate
orymate / config
Created July 23, 2013 21:20
i3 config (beta)
# This file has been auto-generated by i3-config-wizard(1).
# It will not be overwritten, so edit it as you like.
#
# Should you change your keyboard layout somewhen, delete
# this file and re-run i3-config-wizard(1).
#
# i3 config file (v4)
#
# Please see http://i3wm.org/docs/userguide.html for a complete reference!
@orymate
orymate / hdmi.sh
Created June 26, 2013 09:14
Set dual-screen resolutions
#!/bin/bash
xrandr --output LVDS1 --mode 1360x768 --primary
if xrandr | grep 'HDMI.* connected'
then
xrandr --output HDMI1 --mode 1280x1024 --left-of LVDS1
xrandr --output VGA1 --off
elif xrandr | grep 'VGA.* connected'
then
@orymate
orymate / citeurl.py
Last active December 17, 2015 14:49
#!/usr/bin/python
from __future__ import unicode_literals
import urllib
import BeautifulSoup
import sys
import string
import codecs
soup = BeautifulSoup.BeautifulSoup(urllib.urlopen(sys.argv[1]))
@orymate
orymate / comment.sh
Last active April 2, 2021 20:40
UNIX gyakorló példák
#!/bin/bash
# display line-of-comments/loc rate of parameters
LOC=0
EMPTY=0
COMMENT=0
printf "%-40s%8s%8s%8s\n" "File name" "LOC" "Comment" "SLOC"
while [ "$1" != '' ]
do
@orymate
orymate / models.py
Created April 23, 2013 11:37
Abstract base class model that provides self-updating discriminators for fast multi-table inheritance.
from django.db import models
class DiscriminatedModel(models.Model):
"""
An abstract base class model that provides self-updating discriminators for
fast multi-table inheritance.
"""
discriminator = models.CharField(max_length=255)