Skip to content

Instantly share code, notes, and snippets.

View Igosuki's full-sized avatar

Guillaume Balaine Igosuki

View GitHub Profile
@Igosuki
Igosuki / log4j.properties
Created August 31, 2021 16:02
Parquet to Avro spark conversion
#!/bin/sh
BASEDIR=`dirname $0`
$BASEDIR/run_script $BASEDIR/parquet_to_avro.scala -c spark.driver.globs=$1 -c spark.driver.out=$2 -c spark.sql.sources.partitionOverwriteMode=dynamic
@Igosuki
Igosuki / index.js
Last active November 7, 2020 21:42
JS JSON parser
const _ = require('lodash');
const OPEN_BRACE = '{';
const CLOSE_BRACE = '}';
const OPEN_BRACKET = '[';
const CLOSE_BRACKET = ']';
const DOUBLE_QUOTE = '"';
const BACKSLASH = '\\';
const COMMA = ',';
const SEMICOLON = ':';
@Igosuki
Igosuki / main.rs
Created April 26, 2020 12:31
Life of a tree
#[derive(Debug)]
enum Tree {
Seed,
Sprout,
Seedling,
Sapling,
Mature,
Decline,
Snag,
}
@Igosuki
Igosuki / extensions.rs
Created April 8, 2020 17:25
rust-protobuf
// This file is generated by rust-protobuf 3.0.0-pre. Do not edit
// .proto file is parsed by protobuf-codegen-pure=3.0.0-pre
// @generated
// https://github.com/rust-lang/rust-clippy/issues/702
#![allow(unknown_lints)]
#![allow(clippy::all)]
#![cfg_attr(rustfmt, rustfmt_skip)]
@Igosuki
Igosuki / binary.yml
Last active March 30, 2020 14:48
Workflow for cargo
on: [push]
env:
BUILD_ENV: staging
RUN_CMD: 'docker run --rm -it --user rust -e RUSTFLAGS="-C target-cpu=skylake" -v "$HOME/.cargo/git":/home/rust/.cargo/git -v "$(pwd)/cargo-registry":/home/rust/.cargo/registry -v "$(pwd)/cargo-target":/home/rust/src/target -v "$(pwd)":/home/rust/src ekidd/rust-musl-builder:nightly-2019-12-19'
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
@Igosuki
Igosuki / TracingMiddleware.scala
Created January 31, 2020 16:49
Natchez Tracing
package com.me
import cats.data.{Kleisli, OptionT}
import cats.effect.{Bracket, Resource}
import cats.{Defer, Monad, ~>}
import natchez._
import org.http4s.{HttpRoutes, Request, Response}
import cats.implicits._
import scala.util.control.NonFatal
@Igosuki
Igosuki / NormalCode.scala
Created November 21, 2019 12:30
How not to code
for {
app <- distinctBundles
day <- dateRange(inputStart, inputEnd)
hour <- (0 to 23)
path = buildPath(inputPath, hour, day, app)
} yield (path, fileSystem.isDirectory(new Path(path)))
@Igosuki
Igosuki / index.js
Last active November 21, 2019 10:20
Reading NodeJS JSON encoded buffers in Python.
const j = '{"type":"Buffer","data":[93,204,151,170,0,0,194,155,10,119,139,1,10,13,41,43]}'
const buffer = Buffer.from(JSON.parse(j).data)
console.log(JSON.stringify(buffer)); // verify that a buffer is stringified as the string above by default
console.log('buffer string value : ' + buffer.toString('hex')) // concat with str
@Igosuki
Igosuki / index.js
Created November 21, 2019 10:18
Reading NodeJS JSON encoded buffers in Python.
const j = '{"type":"Buffer","data":[93,204,151,170,0,0,194,155,10,119,139,1,10,13,41,43]}'
const buffer = Buffer.from(JSON.parse(j).data)
console.log(typeof buffer);
console.log('str' + buffer.toString('hex'))
@Igosuki
Igosuki / mywidget.php
Created May 10, 2019 16:35
Wordpress widget
<?php
global $wpdb;
$current_user_id = get_current_user_id();
$search_history = $wpdb->get_results("SELECT * FROM {$wpdb->prefix}relevanssi_log WHERE user_id = {$current_user_id} ORDER BY time DESC");
?>