Skip to content

Instantly share code, notes, and snippets.

@joshcangit
joshcangit / meson.py
Last active January 22, 2023 16:32
Wrapper script for meson.pyz (pre-release version)
#!/usr/bin/env python3
from asyncio import run as arun
from os import chmod
from pathlib import Path
from shutil import move, rmtree
from stat import S_IWRITE
from subprocess import run, PIPE, STDOUT, CalledProcessError
from sys import argv, executable, stdout
from tempfile import TemporaryDirectory
from zipapp import create_archive
@joshcangit
joshcangit / ninja-install.sh
Last active May 18, 2022 13:13
Script to download and or update ninja build tool
#!/bin/sh
DIR=$(dirname $(realpath $0))
folder_uid=$(id -u $(find "${DIR}" -maxdepth 0 -printf '%u\n'))
[ "${folder_uid}" -eq 0 ] && [ "$(id -u)" -ne "${folder_uid}" ] && sudo="sudo "
latest_version() {
local RELEASE="https://github.com/ninja-build/ninja/releases/latest"
case "$CMD" in
*xh*) xh HEAD $RELEASE --no-check-status -h | awk '/^location:/{print $2}' | awk -F/ '{print $NF}';;
*curl*) curl -ISs $RELEASE | awk '/^location:/{print $2}' | awk -F/ '{print $NF}';;
@joshcangit
joshcangit / meson.py
Last active January 22, 2023 16:30
Wrapper script for meson.pyz
#!/usr/bin/env python3
from asyncio import run as arun
from functools import partial as fpartial
from importlib import util as libutil
from pathlib import Path
from re import sub
from shutil import move, which
from subprocess import run, PIPE, STDOUT
from sys import argv, executable, stdout
from tarfile import open as topen
@joshcangit
joshcangit / disable-gnome-extensions.sh
Last active January 8, 2022 12:08 — forked from nicfit/disable-gnome-extensions.sh
Disable all gnome-shell extensions from command line.
for ext in $($(type -P ls) ~/.local/share/gnome-shell/extensions); do
gnome-extensions disable $ext;
done
@joshcangit
joshcangit / JanksonExample.java
Last active September 2, 2021 14:39
Example on using Jankson for reading and writing to a file.
//usr/bin/env jbang "$0" "$@";exit $?
//DEPS blue.endless:jankson:1.2.1
import java.io.IOException;
import java.io.Writer;
import java.io.BufferedInputStream;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.charset.Charset;
@joshcangit
joshcangit / Image Clipboard Filer.md
Last active September 19, 2020 10:21 — forked from orschiro/Image Clipboard Filer.md
Python script that saves an image from clipboard to a file.

Introduction

Saves an image from clipboard to a file.

Dependencies:

  • python3
  • PyGTK

Installation

@joshcangit
joshcangit / xseei.export-all.js
Last active November 10, 2020 08:04 — forked from nohamelin/xseei.export-all.js
Export your search engines in only-WebExtensions Mozilla Firefox builds
// -sp-context: browser
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*
* xseei.export-all.js
* ===================
* code-revision 3
* https://gist.github.com/nohamelin/6af8907ca2dd90a9c870629c396c9521
@joshcangit
joshcangit / xseei.import.js
Last active January 16, 2021 22:34 — forked from nohamelin/xseei.import.js
Import search engines in only-WebExtensions Mozilla Firefox builds
// -sp-context: browser
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
*
* xseei.import.js
* ===============
* code-revision 2
* https://gist.github.com/nohamelin/8e2e1b50dc7d97044992ae981487c6ec
@joshcangit
joshcangit / folder-import.php
Last active May 21, 2023 09:08
Import .sql database files from a folder into Adminer.
<?php
/**
* Import SQL files from a directory
*
* @author joshcangit, https://github.com/joshcangit
* @author Roy-Orbison, https://github.com/Roy-Orbison
*/
class AdminerImportFromFolder {