Skip to content

Instantly share code, notes, and snippets.

@jhare
jhare / ap.sh
Last active May 27, 2023 06:25
phind.com lookup ask-phind
#!/usr/bin/env bash
# "summarize what sci-kit-learn is
# example URL https://www.phind.com/search?q=summarize%20what%20sci-kit-learn%20is&source=searchbox
CMD="xdg-open"
NEWTAB=""
PROMPT=""
if [ $# -eq 0 ]; then
echo "Supply args pls"
exit -1
@jhare
jhare / simple_http_server.sh
Created February 18, 2023 05:39 — forked from tdpreece/simple_http_server.sh
Running a Python SimpleHTTPServer in the background and killing it when doneSimpleHTTPServer
#!/usr/bin/env bash
# Create a page in the current dir
echo "My Test Page" > test.html
# Start server
python -m SimpleHTTPServer 8000 &> /dev/null &
pid=$!
# Give server time to start up
@jhare
jhare / jarlook
Created March 26, 2019 19:11
looking inside all jars in dir
#!/bin/bash
# usage: jarlook [targetdir]
# ./jarlook ./lonewolf_ml_caremanagement/ | grep -i 'somefile'
for f in $1/*.jar
do
echo "Processing $f"
unzip -v $f
done
@jhare
jhare / Makefile
Last active August 17, 2018 02:57 — forked from ddevault/Makefile
Tiny Wayland compositor
WAYLAND_PROTOCOLS=/usr/share/wayland-protocols
# wayland-scanner is a tool which generates C headers and rigging for Wayland
# protocols, which are specified in XML. wlroots requires you to rig these up
# to your build system yourself and provide them in the include path.
xdg-shell-protocol.h:
wayland-scanner server-header \
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
xdg-shell-protocol.c: xdg-shell-protocol.h
@jhare
jhare / tmp.c
Created August 16, 2018 04:28 — forked from hadess/tmp.c
Hack to control the keyboard backlight level on a Thinkpad Lenovo X1 Carbon Touch
/* gcc -o tmp `pkg-config --libs --cflags glib-2.0` tmp.c
*
* # modprobe ec_sys
*
* # watch -n 0.1 hexdump -C /sys/kernel/debug/ec/ec0/io
*
* 00000000 a7 05 a0 e2 00 86 05 00 00 00 47 00 00 03 00 10 |..........G.....|
* 00000000 a7 05 a0 e2 00 86 05 00 00 00 47 00 00 43 00 10 |..........G..C..|
* 00000000 a7 05 a0 e2 00 86 05 00 00 00 47 00 00 83 00 10 |..........G.....|
System.out.println("Press any key to continue...");
try
{
System.in.read();
}
catch(Exception e)
{}
@jhare
jhare / exception-example.java
Created March 11, 2016 03:37
exception-example.java
public void writeList() {
PrintWriter out = null;
try {
System.out.println("Entering" + " try statement");
out = new PrintWriter(new FileWriter("OutFile.txt"));
for (int i = 0; i < SIZE; i++) {
out.println("Value at: " + i + " = " + list.get(i));
}
@jhare
jhare / gist:ce49b97c0d349e2658a8
Created August 27, 2015 05:56
terrible placement rep
I hope you are having a wonderful day! I wanted to personally reach out to you since we had some contact at Tech Fest a few weeks ago. I would love the opportunity to network with you if possible. J
Is there a good time we could spend a few minutes on the phone? Please let me know!
Thanks Joseph!
@jhare
jhare / good-drop-shadow.css
Created April 2, 2015 05:48
drop shadow I like
-webkit-box-shadow: rgba(0, 0, 0, 0.4) 0px 2px 30px 0px;
@jhare
jhare / gist:5221888
Created March 22, 2013 14:55
Handy Vim window resizing with arrow keys
map <up> <C-W>+
map <down> <C-W>-
map <left> <C-W><
map <right> <C-W>>