Skip to content

Instantly share code, notes, and snippets.

View w33tmaricich's full-sized avatar

Alexander Maricich w33tmaricich

  • LightFeather.io
  • Bowie, MD
View GitHub Profile
@w33tmaricich
w33tmaricich / image.clj
Last active August 16, 2019 14:25 — forked from jkk/image.clj
Convert images to different formats
;; depends on [org.imgscalr/imgscalr-lib "4.2"]
(ns XXX.image
(:refer-clojure :exclude [read])
(:require [clojure.java.io :as io])
(:import [org.imgscalr Scalr Scalr$Method Scalr$Mode]
[java.awt Image]
[java.awt.image RenderedImage BufferedImageOp]
[javax.imageio ImageIO ImageWriter ImageWriteParam IIOImage]
@w33tmaricich
w33tmaricich / checkBeforeAppend.sh
Created November 19, 2018 19:58
bash: check before appending to file
#!/bin/bash
FILE_PATH=somefile.txt
function appendToFile {
echo $@ >> $FILE_PATH
}
function checkBeforeAppend {
(cat $FILE_PATH | grep "$@" && echo "$@ already set") || appendToFile "$@"
}
@w33tmaricich
w33tmaricich / index.html
Created November 16, 2018 15:23
groff: groff_ms man pages
<!DOCTYPE html>
<html prefix="og: http://ogp.me/ns# ">
<head><script data-cfasync='false' data-pagespeed-no-defer>var __ez=__ez||{};__ez.evt={};__ez.ck={};__ez.dot={};__ez.template={};__ez.template.isOrig=false;__ez.evt.add=function(e,t,n){e.addEventListener?e.addEventListener(t,n,!1):e.attachEvent?e.attachEvent("on"+t,n):e["on"+t]=n()},__ez.evt.remove=function(e,t,n){e.removeEventListener?e.removeEventListener(t,n,!1):e.detachEvent?e.detachEvent("on"+t,n):delete e["on"+t]};__ez.ck.get=function(e,n){null!==n&&(e=e+"_"+n);for(var o=e+"=",t=decodeURIComponent(document.cookie).split(";"),i=0;i<t.length;i++){for(var c=t[i];" "===c.charAt(0);)c=c.substring(1);if(0===c.indexOf(o))return c.substring(o.length,c.length)}return""},__ez.ck.setByCat=function(e,n){if("undefined"!=typeof cmpIsOn){if(null!=n){var o=__ez.ck.get("ezCMPCookieConsent",null);-1!==(o=o.substring(1,o.length)).indexOf(n+"=1")?document.cookie=e:""===o&&"undefined"!=typeof cmpCookies&&(void 0===cmpCookies[n]&&(cmpCookies[n]=[]),cmpCookies[n].push(e))
@w33tmaricich
w33tmaricich / keyboard_remap.sh
Created November 15, 2018 16:02
keyboard: xkbset numpad mouse movement
#!/bin/bash
# Use "xev" to find the correct keycodes
# For unusual items, you may need to look in /usr/include/X11/keysymdef.h (then remove the leading "XK_" when editing your script
# xkbset and xev are probably not installed by default but should be in your distro's repositories
# Pointer_Button1 = left click, Pointer_Button2 = middle click; Pointer_Button3 = right click
sudo apt install -y xkbset
xkbset m
#xmodmap -e "keysym Super_L = Mode_switch"
#xmodmap -e "keycode 31 = Up Up"
@w33tmaricich
w33tmaricich / openscad-cheatsheet.md
Last active October 24, 2018 15:24
openscad: openscad cheatsheet
@w33tmaricich
w33tmaricich / correct.file
Created July 10, 2018 18:01
php: get file contents from regex search
This is the correct string.
@w33tmaricich
w33tmaricich / xmltest.php
Last active June 25, 2018 14:04
php: load and save xml
<?php
$fileName = "fun.xml";
$keystorepath = "this/is/a/path.jks";
$keystorepassword = "keystorepassword";
$fileContents = file_get_contents($fileName);
$xml = simplexml_load_string($fileContents);
@w33tmaricich
w33tmaricich / normalize.css
Created June 9, 2018 04:53
css: normalize
/*! normalize.css v5.0.0 | MIT License | github.com/necolas/normalize.css */
/**
* 1. Change the default font family in all browsers (opinionated).
* 2. Correct the line height in all browsers.
* 3. Prevent adjustments of font size after orientation changes in
* IE on Windows Phone and in iOS.
*/
/* Document
@w33tmaricich
w33tmaricich / usage-template.sh
Created June 5, 2018 19:15
sh: usage example
programname=$0
function usage {
echo "usage: $programname [-abch] [-f infile] [-o outfile]"
echo " -a turn on feature a"
echo " -b turn on feature b"
echo " -c turn on feature c"
echo " -h display help"
echo " -f infile specify input file infile"
echo " -o outfile specify output file outfile"
exit 1
@w33tmaricich
w33tmaricich / toupper.sh
Created June 5, 2018 19:06
sh: to uppercase
variable=`echo $LOWER | awk '{print toupper($0)}'`