Skip to content

Instantly share code, notes, and snippets.

@nagyv
nagyv / git_push.yaml
Created Sep 14, 2021
GitLab CI job for Git push
View git_push.yaml
# Usage
# in .gitlab-ci.yml
# commit packages:
# extends: .git:push
# stage: deploy
# variables:
# COMMIT_MESSAGE: "Hydrated packages"
# script:
# cp -r file-to-commit/* "${CI_COMMIT_SHA}/file-to-commit/"
# dependencies:
@nagyv
nagyv / middleware.py
Created Oct 29, 2012
Django facebook connect middleware w/ facepy
View middleware.py
import logging
import facepy as facebook
from django.conf import settings
from django.contrib.auth.signals import user_logged_in
from django.db import models
from django.contrib.auth import logout
from django.contrib.auth.models import User
class FBAuthMiddleware(object):
def __init__(self):
View keybase.md

Keybase proof

I hereby claim:

  • I am nagyv on github.
  • I am nagyv (https://keybase.io/nagyv) on keybase.
  • I have a public key ASBS9dc3poTC2gmEbZN-_wX0M-SmIGwWJ5huIaxZPQwljQo

To claim this, I am signing this object:

@nagyv
nagyv / index.js
Created Apr 19, 2019
get and create record in GameSparks Data Service
View index.js
const axios = require('axios')
require('dotenv').config()
const username = process.env.LOGIN
const password = process.env.PASSWORD
const game = process.env.GAME
async function jwtAuth(username, password, game, filter) {
const response = await axios({
url: `https://auth.gamesparks.net/restv2/auth/game/${game}/jwt`,
@nagyv
nagyv / fields.py
Created May 22, 2012
Google Protobuffer field for Django
View fields.py
''' A model field to store and retrieve Google Protocol Buffer objects easily.
Uses the BlobField available on GAE for storage.
Usage:
myfield = ProtobufField(protoclass=MyProtocolClass)
where MyProtocolClass is a protocol descriptor class generated from a .proto file.
The field is supposed to store only the given kind of protocol messages.
@nagyv
nagyv / 0 - odoo logs to sentry
Last active Dec 5, 2018 — forked from avoine/gist:2912777
Script to send rsyslog message of OpenERP to Sentry
View 0 - odoo logs to sentry
This gist provides a simple setup to add Sentry logging to OpenERP/Odoo.
As Odoo's logging setup is rather limited, I'm using syslog to collect and forward logs to Sentry.
These scripts should run without any modification on an Ubuntu based server, assuming the paths and user names for openerp match with the ones in the `supervisord.conf` file.
To have rsyslog2sentry run fine, you'll need some python pagkages installed
$ pip install raven loggerglue
@nagyv
nagyv / rebuild_libreoffice.sh
Last active Oct 4, 2018 — forked from lukebranch/rebuild_libreoffice.sh
Rebuild Libreoffice for ubuntu 14.04 trusty with python2 support for python-uno
View rebuild_libreoffice.sh
#!/bin/sh
# we need some fixes from 14.10
# sudo add-apt-repository --enable-source ppa:libreoffice/libreoffice-4-3
sudo add-apt-repository --enable-source ppa:libreoffice/libreoffice-4-3 -y
# fetch this repository
sudo apt-get update -y
# update your libreoffice installation
sudo apt-get install libreoffice python3-uno -y
# get all build dependencies for libreoffice
sudo apt-get build-dep libreoffice -y
@nagyv
nagyv / 1 - readme.md
Created Jun 3, 2018
using Nes with Schmervice
View 1 - readme.md

This is a simple example to use Nes with Schmervice in hapipal-like project.

As there might be several susbcription channels, I prefer to separate them by domain, and have a single service that handles all the even passing between different parts of the code.

Example usage:

  // somewhere in a router's handler
@nagyv
nagyv / goaccess.py
Created May 6, 2014
A python script for downloading and processing Amazon S3 logs using goaccess
View goaccess.py
#!/bin/python
import os
from boto.s3.connection import S3Connection
import subprocess
from datetime import datetime, date
import argparse
import tempfile
import json
parser = argparse.ArgumentParser(description="Downloads logs from S3, and parses them with goaccess.")
@nagyv
nagyv / example.html
Created Feb 6, 2018
example html for an RN bug report
View example.html
<!DOCTYPE html>
<html lang="en">
<head>
<script>
// from: https://github.com/facebook/react-native/issues/11594#issuecomment-274689549
function awaitPostMessage() {
let isReactNativePostMessageReady = !!window.originalPostMessage;
const queue = [];
let currentPostMessageFn = function store(message) {
if (queue.length > 100) queue.shift();