Skip to content

Instantly share code, notes, and snippets.

View cebe's full-sized avatar
☁️
working on cebe.cloud

Carsten Brandt cebe

☁️
working on cebe.cloud
View GitHub Profile
@cebe
cebe / Makefile
Last active January 25, 2023 09:49
How to run docker commands as your local user, not root
# This is a Makefile that implements helpers for a docker stack
#
# This example shows how to run a bash in a docker-compose container as your local user,
# so files are created owned by that user instead of root.
#
# For this to work, the user inside the container must have the same ID as the user outside.
# The name does not matter much but to avoid confusion it is helpful to make them have the same user name.
# You get a users ID by running the `id -u` command, and the users name is `whoami`.
#
# How it works:
-- Cleans up IPB 3 database before importing it into another forum engine
-- tbl_* are project specific, could be removed
-- Remove banned members and members with no posts
delete m
from ipb_members m
left join tbl_user u on u.id = m.member_id
where
(
member_banned = 1
@notwaldorf
notwaldorf / list.md
Last active January 13, 2024 11:09
Meownica's packing list

Meownica's packing list

I travel a lot so I'm down to like 30 minutes of packing per any kind of trip. I always bring one carry-on suitcase for any trips up to 2 weeks (that I never check in unless forced) -- I have an Away suitcase because it's got a built-in (removable) battery, and amazing wheels.

🚨

  • 🆔Wallet & Passport
  • 💧Travel water bottle
  • 💳Travel credit cards (don't pay foreign currency fees!)
  • 💳Insurance cards
  • 💵Local currency you have
  • 🚎Local public transport cards
@tom--
tom-- / README.md
Last active October 14, 2017 19:47
Controling a group of daemons and timer jobs with a systemd target

Controling a group of daemons and timer jobs with a systemd target

Scenario

The custom web application My App, in addition to its web server request-driven work, has three daemons (able, baker and charlie) and three jobs (dog, easy and fox) that run (cron-like) on a pre-defined schedule.

Requirements

@SkyzohKey
SkyzohKey / konv-ux-whitepaper.md
Last active April 17, 2017 21:01
Konv UX Whitepaper

Konv UX whitepaper

1. Summary

Konv aims to be a modern, easy-to-use and secure Instant Messaging Skype replacement. It should provides a cool UI/UX to end-users, with a « Power user » mode to allow more skilled guys to enjoy it too.

Konv should be finely designed and simple to understand with the first time, even a grandma should be able to use it without troubles.

Konv should provides at least features others IM apps (Skype, Whatsapp, Messenger, etc) has plus extra features that'll make it unique.

2. Targeted users

@cebe
cebe / .gitignore
Last active April 21, 2022 14:34
CGAL fails to read OFF file generated by Minkowsky Sum https://github.com/CGAL/cgal/issues/978
/bug
/*.o
@tom--
tom-- / Random bytes, ints, UUIDs in PHP.md
Last active February 11, 2023 06:14
PHP random bytes, integers and UUIDs

Random bytes, ints, UUIDs in PHP

Simple and safe random getters to copy-paste

string randomBytes( int $length )

int randomInt ( int $min , int $max )

string randomUuid ( void )
@tom--
tom-- / generateRandomKeyReqs.php
Created January 4, 2016 16:28
Detailed requirements checks for Yii 2.0.7's yii\base\Security::generateRandomKey()
<?php
$tests = [
"function_exists('random_bytes')",
"defined('OPENSSL_VERSION_TEXT') ? OPENSSL_VERSION_TEXT : null",
"PHP_VERSION_ID",
"function_exists('mcrypt_create_iv') ? bin2hex(mcrypt_create_iv(8, MCRYPT_DEV_URANDOM)) : null",
"DIRECTORY_SEPARATOR",
"sprintf('%o', lstat('/dev/urandom')['mode'])",
"sprintf('%o', lstat('/dev/urandom')['mode'] & 0170000)",
__ __ _ ___ _ _
\ \ / /_ _| |__ / __| |_ __ ___ _(_)_ _ __ _
\ V / _` | / / \__ \ ' \/ _` \ V / | ' \/ _` |
|_|\__,_|_\_\ |___/_||_\__,_|\_/|_|_||_\__, |
|___/ YAK SHAVING LTD
═══════════════
Company Number: 09522289
73 Douglas Buildings
Marshalsea Road
@tom--
tom-- / 3-way-joins.md
Last active October 20, 2020 09:42
Using 3-way join tables in Yii 2 Active Record

I have an interesting Yii 2 AR design problem.

The DB has 12 primary entity tables related via a full mesh of 72 join tables. Each relation also has a type (and attributes) but those aren't stored in the join tables – they are in additional tables that the 72 join tables reference. So each of the 72 join tables provides a 3-way join between one entity, another entity and another table called link that points to the link_type.

My problem is to write the AR models and relation methods.

Let's make this more concrete with two of the primary entities: artist and recording, related through l_artist_recording. Each record of l_artist_recording has an FK to the link table, through which I can load the link_type name. For example, an artist-recording relation might have link_type "performer", "conductor", or "producer" etc.

This is a simplified schma good enough for thinking about the AR p