Skip to content

Instantly share code, notes, and snippets.

View ctapobep's full-sized avatar

Stanislav Bashkyrtsev ctapobep

View GitHub Profile
@ctapobep
ctapobep / Bases.java
Last active December 28, 2025 17:31
Command line utility to print a number/letter in ASCII, Dec, Hex
void main(String[] args) {
if(args.length == 0 || args[0].isBlank()) {
IO.println("Pass a number (in Hex or Dec) or a letter");
System.exit(1);
}
String s = args[0];
IO.println(justify("Str", "Hex", "Dec", "Bin", "Description"));
if(s.length() == 1) {
int code = s.codePointAt(0);
printAscii(code, 0);
@ctapobep
ctapobep / helsinki-java-coffee.json
Last active May 16, 2026 11:09
Helsinki Java Coffee events
{
"event": {
"date": "17/05/2026",
"link": "https://gist.github.com/ctapobep/c60f8ff47022053647faf8fa6dbebdb9"
},
"members": 4
}
@ctapobep
ctapobep / paddle-postgres-etl.sql
Created January 18, 2025 13:09
ETL Paddle events to Postgres tables
-- Create tables:
create table paddle_events_sandbox(id text primary key, type text, occurred_at timestamptz, data jsonb);
create index on paddle_events_sandbox(type);
create index on paddle_events_sandbox(occurred_at);
create table paddle_events_prd(id text primary key, type text, occurred_at timestamptz, data jsonb);
create index on paddle_events_prd(type);
create index on paddle_events_prd(occurred_at);
-- Stored procedure itself:
create or replace function insert_next_paddle_page(env text, paddle_token text) returns int as $$ declare
@ctapobep
ctapobep / crystallography-notes.md
Last active January 19, 2023 13:34
Crystallography notes

Unit cell and coorindates

A unit cell is defined by 3 base vectors $\underline{a_1}$, $\underline{a_2}$, $\underline{a_3}$ (in this field vectors are denoted with underscores), each has an angle (direction) and a length.

Any coordinate is within the unit cell (or outside of it) is defined as a linear combination of these vectors: [1 2 3]. If values aren't integers, then we multiply them to get integers.

$$ p = \begin{bmatrix}u_1 & u_2 & u_3\end{bmatrix} \begin{bmatrix}\underline{a_1} & \underline{a_2} & \underline{a_3}\end{bmatrix} = \begin{bmatrix}u_1 & u_2 & u_3\end{bmatrix} \begin{bmatrix}

@ctapobep
ctapobep / Configuring Mac
Last active January 7, 2017 19:11
Linux like Mac
ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
# http://apple.stackexchange.com/questions/69223/how-to-replace-mac-os-x-utilities-with-gnu-core-utilities
brew install coreutils
echo "PATH=/usr/local/opt/coreutils/libexec/gnubin:$PATH" >> ~/.bash_profile
echo "MANPATH=/usr/local/opt/coreutils/libexec/gnuman:$MANPATH" >> ~/.bash_profile
brew install gnu-tar
brew install gnu-sed
brew install gawk