Skip to content

Instantly share code, notes, and snippets.

View gjaldon's full-sized avatar
🏠
Working from home

G gjaldon

🏠
Working from home
View GitHub Profile
@gjaldon
gjaldon / build_order_wins_by_champion_role.ex
Last active February 17, 2020 16:26
Counter tables for build orders and stats
# Version 1 - Counter table
# Ideal for when we update the games/wins columns a lot more often than we read them.
# Writes on counter fields is more performant than writing on integer fields since it does not do a
# read-before-write. The drawback is that counter columns can not be used as part of the primary key
# so rows inside a partition can not be order by `games` and `wins` columns.
# Also, we can not use TTLs on counter tables. We will need to delete them when a new patch comes out.
table :build_order_wins_by_champion_role, keyspace: LeagueStats.LeagueStatsScyllaKeyspace do
field :patch, :text, validators: [presence: true]
field :region, :text, validators: [presence: true]
@gjaldon
gjaldon / create_materialized_views.cql
Last active December 30, 2019 17:31
Scylla Initial Schema
CREATE MATERIALIZED VIEW league_stats.encrypted_summoner_account_by_account_id AS
SELECT *
FROM league_stats.encrypted_summoner_accounts
WHERE region IS NOT NULL AND account_id IS NOT NULL AND summoner_id IS NOT NULL AND encrypted_account_id IS NOT NULL AND encrypted_summoner_id IS NOT NULL
PRIMARY KEY ((region, account_id), summoner_id, encrypted_account_id, encrypted_summoner_id)
WITH CLUSTERING ORDER BY (summoner_id ASC, encrypted_account_id ASC, encrypted_summoner_id ASC)
AND bloom_filter_fp_chance = 0.01
AND caching = '{"keys":"ALL","rows_per_partition":"ALL"}'
AND comment = ''
AND compaction = {'class': 'SizeTieredCompactionStrategy'}
make install --directory=libhubbub HOST=x86_64-unknown-redox PREFIX=/home/gjaldon/redox/cookbook/recipes/netsurf/build/inst-framebuffer Q= WARNFLAGS='-Wall -W -Wno-error' DESTDIR=
make[2]: Entering directory '/home/gjaldon/redox/cookbook/recipes/netsurf/build/libhubbub'
/home/gjaldon/redox/cookbook/recipes/netsurf/build/inst-framebuffer/share/netsurf-buildsystem/makefiles/Makefile.top:267: warning: overriding recipe for target 'clean'
examples/Makefile:14: warning: ignoring old recipe for target 'clean'
make[2]: *** No rule to make target 'libxml2.c', needed by 'libxml2.o'. Stop.
make[2]: Leaving directory '/home/gjaldon/redox/cookbook/recipes/netsurf/build/libhubbub'
Makefile:119: recipe for target '/home/gjaldon/redox/cookbook/recipes/netsurf/build/inst-framebuffer/build-stamp' failed
make[1]: *** [/home/gjaldon/redox/cookbook/recipes/netsurf/build/inst-framebuffer/build-stamp] Error 2
make[1]: Leaving directory '/home/gjaldon/redox/cookbook/recipes/netsurf/build'
./repo.sh failed.mk/filesystem.mk:2: recip
examples/Makefile:14: warning: ignoring old recipe for target 'clean'
mkdir -p build-x86_64-linux-gnu-x86_64-unknown-redox-release-lib-static
mkdir -p build-x86_64-linux-gnu-x86_64-unknown-redox-release-lib-static/coverage
touch build-x86_64-linux-gnu-x86_64-unknown-redox-release-lib-static/stamp
ENTITIES: src/tokeniser/entities.inc
perl build/make-entities.pl
make[2]: *** No rule to make target 'libxml2.c', needed by 'libxml2.o'. Stop.
make[2]: Leaving directory '/Users/gjaldon/code/oss/redox/cookbook/recipes/netsurf/build/libhubbub'
Makefile:119: recipe for target '/Users/gjaldon/code/oss/redox/cookbook/recipes/netsurf/build/inst-framebuffer/build-stamp' failed
make[1]: *** [/Users/gjaldon/code/oss/redox/cookbook/recipes/netsurf/build/inst-framebuffer/build-stamp] Error 2
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... no
checking how to hardcode library paths into programs... immediate
checking for shl_load... configure: error: Link tests are not allowed after GCC_NO_EXECUTABLES.
Reaping losing child 0x7fe3e4b021d0 PID 89831
make[1]: *** [configure-target-libstdc++-v3] Error 1
Removing child 0x7fe3e4b021d0 PID 89831 from chain.
Reaping losing child 0x7fc6e9c148b0 PID 93215
make: *** [prefix/x86_64-unknown-redox/gcc-install] Error 2
Removing child 0x7fc6e9c148b0 PID 93215 from chain.
# client/Dockerfile
FROM node:6.9.5-alpine
RUN apk --update add git openssh build-base python
RUN npm install -g webpack
ADD package.json /tmp/package.json
RUN cd /tmp && npm install
RUN mkdir /client/ && cp -a /tmp/node_modules /client/
```
Order schema
- has_many order_items
- has_many taxes
- has_many fees
- has_many discounts
- id
- timestamps
- print_count (for storing number of times order was printed)
- note - string
tar: ./usr/share/terminfo/m: Directory renamed before its status could be extracted
tar: ./usr/share/terminfo/n: Directory renamed before its status could be extracted
tar: ./usr/share/terminfo/Q: Directory renamed before its status could be extracted
tar: ./usr/share/terminfo/d: Directory renamed before its status could be extracted
tar: ./usr/share/terminfo/r: Directory renamed before its status could be extracted
tar: ./usr/share/terminfo/6: Directory renamed before its status could be extracted
tar: ./usr/share/terminfo/w: Directory renamed before its status could be extracted
tar: ./usr/share/terminfo/g: Directory renamed before its status could be extracted
tar: ./usr/share/terminfo/j: Directory renamed before its status could be extracted
tar: ./usr/share/terminfo/4: Directory renamed before its status could be extracted
## conn_case.ex code
setup tags do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Reporting.RepoWrite)
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Profilix.RepoRead)
:ok = Ecto.Adapters.SQL.Sandbox.checkout(ACL.RepoRead)
unless tags[:async] do
Ecto.Adapters.SQL.Sandbox.mode(Reporting.RepoWrite, {:shared, self()})
Ecto.Adapters.SQL.Sandbox.mode(Profilix.RepoRead, {:shared, self()})
# In ConnCase setup
setup tags do
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Reporting.Repo)
:ok = Ecto.Adapters.SQL.Sandbox.checkout(Profilix.RepoRead)
unless tags[:async] do
Ecto.Adapters.SQL.Sandbox.mode(Reporting.Repo, {:shared, self()})
Ecto.Adapters.SQL.Sandbox.mode(Reporting.Repo, {:shared, self()})
end
end