Skip to content

Instantly share code, notes, and snippets.

View Johnz86's full-sized avatar

Jan Jakubcik Johnz86

  • Slovakia
View GitHub Profile
@Johnz86
Johnz86 / CLONE_DATASET.md
Created October 25, 2024 09:40
Downloading Smaller Parquet Datasets from Hugging Face

When working with large datasets on Hugging Face, downloading in JSON format can be cumbersome due to the large size of the files. Fortunately, some datasets provide automatically converted Parquet versions, which are much smaller and optimized for efficient data storage and access.

In this example, we demonstrate how to download only the Parquet files instead of the entire dataset in JSON.


Example: ScaleQuest-Math

Dataset URL: ScaleQuest-Math

@Johnz86
Johnz86 / AddJsonKey.ps1
Created November 7, 2022 16:54
Example how to add formated key and value to json file with powershell.
param([Parameter(Mandatory)]$key, [Parameter(Mandatory)]$value, $file='.\i18n.json')
if ($value -eq $null) {
$value = read-host -Prompt "Please enter a value"
}
function Format-Json([Parameter(Mandatory, ValueFromPipeline)][String] $json) {
$indent = 0;
($json -Split "`n" | % {
if ($_ -match '[\}\]]\s*,?\s*$') {
interface Presentation {
defaultRequest: PresentationRequest;
receiver: PresentationReceiver;
}
interface PresentationReceiver {
connectionList: Promise<PresentationConnectionList>;
}
interface PresentationConnection {
binaryType: ArrayBuffer | Blob;
@Johnz86
Johnz86 / fullscreen.ts
Created February 13, 2020 14:15
Example of fulllscreen functionality written in typescript, that supports multiple browsers.
interface DocumentWithFullscreen extends HTMLDocument {
mozFullScreenElement?: Element;
msFullscreenElement?: Element;
webkitFullscreenElement?: Element;
msExitFullscreen?: () => void;
mozCancelFullScreen?: () => void;
webkitExitFullscreen?: () => void;
}
export function isFullScreen(): boolean {
@Johnz86
Johnz86 / fetch.ts
Created July 15, 2019 15:45
RxJS implementation of fromFetch with node-fetch node module
import { Observable } from 'rxjs';
import fetch, { RequestInit, Request, Response } from 'node-fetch';
import AbortController from 'abort-controller';
export type RequestInit = RequestInit;
export function fromFetch(input: string | Request, init?: RequestInit): Observable<Response> {
return new Observable<Response>(subscriber => {
const controller = new AbortController();
const signal = controller.signal;
@Johnz86
Johnz86 / main-ipc.ts
Created December 19, 2018 22:13
Basic example how to promisify electron's ipc comunication between main process and renderers.
import { ipcMain, BrowserWindow, Event } from 'electron'
const getResponseChannels = (channel:string) => ({
sendChannel: `%app-send-channel-${channel}`,
dataChannel: `%app-response-data-channel-${channel}`,
errorChannel: `%app-response-error-channel-${channel}`
})
const getRendererResponseChannels = (windowId: number, channel: string) => ({
sendChannel: `%app-send-channel-${windowId}-${channel}`,
@Johnz86
Johnz86 / backup-git.bat
Created June 8, 2018 08:09
Backup git projects to external disk without node_modules on windows via command line.
robocopy . E:\backup\GIT\. /IS /S /XD node_modules
@Johnz86
Johnz86 / Training.json
Created May 22, 2018 14:28
Basic definition of smalltalk for articulate.
{
"language": "en",
"timezone": "UTC",
"agentName": "SaraCSML",
"useWebhook": false,
"description": "Sara is support chatbot for update management.",
"fallbackResponses": [
"Sorry can you rephrase that?",
"I'm still learning to speak with humans. What you mean?"
],
@Johnz86
Johnz86 / mount-docker-volume.sh
Created April 28, 2018 10:01
Mount local windows folder to docker volume in docker-machine virtualbox
#!/bin/bash
docker volume create $docker_volume
docker-machine ssh default -- "sh -c 'sudo mount -o uid=1000,gid=1000 -t vboxsf $docker_volume $(docker inspect $docker_volume -f {{.Mountpoint}})'"
@Johnz86
Johnz86 / .env.local
Created April 6, 2018 13:32
Setting up docker-machine proxy on the fly for gitbash under windows 7.
http_proxy=http://194.138.0.3:9400
https_proxy=http://194.138.0.3:9400