Skip to content

Instantly share code, notes, and snippets.

View allixsenos's full-sized avatar

Luka Kladarić allixsenos

View GitHub Profile
@allixsenos
allixsenos / .github-workflows-main.yml
Last active December 14, 2022 11:11
dkorunic/e-dnevnik-bot + Github Actions = <3
name: e-imenik run
# Controls when the action will run.
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Run on push to any branch for testing
push:
# Run every 6 hours
schedule:
#!/bin/bash
#set -x
# Shows you the largest objects in your repo's pack file.
# Written for osx.
#
# @see http://stubbisms.wordpress.com/2009/07/10/git-script-to-show-largest-pack-objects-and-trim-your-waist-line/
# @author Antony Stubbs
# Modified by Luka Kladaric <luka@noom.com>
@allixsenos
allixsenos / docker-compose.yml
Created March 17, 2018 22:04
One click Phabricator install using docker
version: '2'
services:
mariadb:
image: 'bitnami/mariadb:latest'
environment:
- ALLOW_EMPTY_PASSWORD=yes
volumes:
- 'mariadb_data:/bitnami'
phabricator:
image: 'bitnami/phabricator:latest'
@allixsenos
allixsenos / user-data.yml
Created June 23, 2017 20:23
AWS EC2 user data to enable root SSH and to install python
#cloud-config
repo_update: true
repo_upgrade: all
disable_root: false
packages:
- python-minimal
Wordlist ver 0.732 - EXPECT INCOMPATIBLE CHANGES;
acrobat africa alaska albert albino album
alcohol alex alpha amadeus amanda amazon
america analog animal antenna antonio apollo
april aroma artist aspirin athlete atlas
banana bandit banjo bikini bingo bonus
camera canada carbon casino catalog cinema
citizen cobra comet compact complex context
credit critic crystal culture david delta
dialog diploma doctor domino dragon drama

Simple Security Guidelines

  • Use an iDevice

    • Use an iPod or an iPad without a SIM card
    • Use an iPhone
    • Do not jailbreak
    • Always upgrade to new iOS versions
  • Use Signal (iOS + Android)

@allixsenos
allixsenos / phabricator-map-accounts-to-LDAP.sql
Last active March 11, 2018 13:15
This query will create LDAP mappings for all accounts that don't have them. Useful for migrating from Phacility to self-hosted using LDAP as the only auth method.
USE phabricator_user;
-- create LDAP mappings for unmapped users
-- this query uses a subselect due to the way MySQL reacts to UUID() being
-- wrapped in REPLACE() (returns the same UUID for all rows)
-- WARNING: make sure user.userName maps to LDAP usernames, otherwise
-- user_externalaccount.accountID needs to be modified for those users
-- where it doesn't. alternatively, use Phabricator's change username
-- utility in People app to change those users' usernames before running
INSERT INTO user_externalaccount
'''
Django bulk upsert
Does not attempt to cover all corner cases and related models.
Originally from http://people.iola.dk/olau/python/bulkops.py
Heavily modified by Luka Kladaric hello@luka.io
'''
from itertools import repeat
from django.db import models, connections, transaction

Keybase proof

I hereby claim:

  • I am allixsenos on github.
  • I am allixsenos (https://keybase.io/allixsenos) on keybase.
  • I have a public key whose fingerprint is 2A2F 3C2A B502 941C B0F8 7E9B 6561 D338 82BC FA74

To claim this, I am signing this object:

@allixsenos
allixsenos / explain.py
Last active June 2, 2019 10:08
Django QuerySet Explain
from django.db import connections
from django.db.models.query import QuerySet
from __future__ import print_function
class QuerySetExplainMixin:
def explain(self, analyze=True):
cursor = connections[self.db].cursor()
print(self.query)
print()
sql, params = self.query.sql_with_params()