Skip to content

Instantly share code, notes, and snippets.

View sebastianconcept's full-sized avatar

Sebastian Sastre sebastianconcept

View GitHub Profile
@sebastianconcept
sebastianconcept / gist:156823b0efa32280a34e047a4101d854
Created March 25, 2024 10:50
Deserialize for enum, useful when CSV records map variants with content structurally different
use anyhow::Result;
use csv::{ReaderBuilder, Trim};
use serde::{de, Deserialize, Deserializer};
use std::fmt;
use std::path::Path;
fn main() -> Result<()> {
let file_path = Path::new("shapes.csv");
let mut reader = ReaderBuilder::new()
.has_headers(false)
@sebastianconcept
sebastianconcept / benchmarks.md
Created February 18, 2024 16:52
Benchmaking SingularizePluralize based on RegEx

Here is a snippet to have a reference of the optimization opportunity:

commonWords := (NeoJSONReader fromString: '{
  "description": "Common English words.",
  "commonWords":
    [
      "a",
      "able",
      "about",
@sebastianconcept
sebastianconcept / benchmarks.md
Created November 28, 2022 16:47
Serialize benchmarks BSON vs STON vs NeoJSON vs Fuel vs MCDataStream
mockOne := [ |map| 
	map := Dictionary new.
	32 timesRepeat: [ 
    map 
        at: 1000 atRandom asWords asSymbol 
        put: { 
            2 atRandom = 1. 
            1e9 atRandom. 
            1e9 atRandom negated. 
@sebastianconcept
sebastianconcept / Dockerfile
Created December 1, 2021 16:50
THC Dockerfile
FROM debian:buster
EXPOSE 1700/tcp
# Base support
RUN id && ls -la /var/cache/apt/
RUN \
apt-get update && \
apt-get -y install procps libssl1.1 bzip2 python3 python3-requests wget make zip unzip libx11-6 libgl1-mesa-glx libfontconfig1 libssl1.1 python3-pip libcurl3-gnutls strace
# install image-launch
@sebastianconcept
sebastianconcept / gist:8d64bfd003cb90d1a38b43384ed84354
Created March 7, 2020 11:33
Pharo minimal `make serve` fail log
➜ telepharo git:(master) make server
make -C ../minimal
../bin/download-vm.sh
downloading get.pharo.org/32/vm80
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 5306 100 5306 0 0 5034 0 0:00:01 0:00:01 --:--:-- 5034
Downloading the latest pharoVM:
http://files.pharo.org/get-files/80/pharo-mac-stable.zip
pharo-vm/Pharo.app/Contents/MacOS/Pharo
//
// MIXIN
//
import { Component, Vue } from 'vue-property-decorator'
import stringEntropy from 'fast-password-entropy'
@Component({})
export default class PasswordDefinition extends Vue {
public showPassword: boolean = false
public showConfirmation: boolean = false
version: 2
jobs:
build:
working_directory: /app
docker:
- image: docker:17.05.0-ce-git
auth:
#Put the contents of keyfile.json into an environment variable for the build called GCR_CREDS, which is then passed in.
username: _json_key
password: $GOOGLE_AUTH
@sebastianconcept
sebastianconcept / Smalltalk language notes
Created May 13, 2017 12:55
Smalltalk notes from basics on syntax to many useful general operations
"************************* by Chris Rathman *****************************
* Allowable characters: *
* - a-z *
* - A-Z *
* - 0-9 *
* - .+/\*~<>@%|&? *
* - blank, tab, cr, ff, lf *
* *
* Variables: *
* - variables must be declared before use *
<td>
<span ng-bind="Cases.humaneNextSessionOf(case)"></span>
</td>
and in the controller we have:
...
let result = $compile(thatSpan)($scope);
/** Scott Bakers Colors **/
@adr-red: #ea5a5a;
@adr-blue: #23b1f7;
@adr-yellow: #ffcc00;
@adr-green: #28bd8b;
@adr-dark: #1f222d;
@adr-light-blue: #f4f7fa;
/** Begin Guy **/