Skip to content

Instantly share code, notes, and snippets.

@ginochenhj
ginochenhj / save-file-local.js
Created January 3, 2025 07:02 — forked from liabru/save-file-local.js
Save a text file locally with a filename, by triggering a download in JavaScript
/*
* Save a text file locally with a filename by triggering a download
*/
var text = "hello world",
blob = new Blob([text], { type: 'text/plain' }),
anchor = document.createElement('a');
anchor.download = "hello.txt";
anchor.href = (window.webkitURL || window.URL).createObjectURL(blob);
@ginochenhj
ginochenhj / save-file-local.js
Created January 3, 2025 07:02 — forked from liabru/save-file-local.js
Save a text file locally with a filename, by triggering a download in JavaScript
/*
* Save a text file locally with a filename by triggering a download
*/
var text = "hello world",
blob = new Blob([text], { type: 'text/plain' }),
anchor = document.createElement('a');
anchor.download = "hello.txt";
anchor.href = (window.webkitURL || window.URL).createObjectURL(blob);
@ginochenhj
ginochenhj / Output
Created July 11, 2023 14:43 — forked from Circuitsoft/Output
Capture single image V4L2
Driver Caps:
Driver: "omap3"
Card: "omap3/mt9v032//"
Bus: ""
Version: 0.0
Capabilities: 04000001
Camera Cropping:
Bounds: 752x480+0+0
Default: 752x480+0+0
Aspect: 1/1
@ginochenhj
ginochenhj / multiple-files-remove-prefix.md
Created January 1, 2022 15:48
Remove prefix from multiple files in Linux console

Bash

for file in prefix*; do mv "$file" "${file#prefix}"; done;

The for loop iterates over all files with the prefix. The do removes from all those files iterated over the prefix.

Here is an example to remove "bla_" form the following files:

bla_1.txt
bla_2.txt
@ginochenhj
ginochenhj / DataFrameTreeModel.py
Created August 30, 2020 17:42 — forked from sharpTrick/DataFrameTreeModel.py
Simple script demonstrating a custom Gtk.TreeModel wrapping a Pandas DataFrame for Gtk 3 (known as GenericTreeModel in PyGtk 2).
# I stole most of this from https://gist.github.com/andialbrecht/4463278
import gi
import pandas as pd
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GObject
class DataFrameTreeModel(GObject.GObject, Gtk.TreeModel, Gtk.TreeSortable):