Skip to content

Instantly share code, notes, and snippets.

View hoosierEE's full-sized avatar

Alex Shroyer hoosierEE

View GitHub Profile
@joubertnel
joubertnel / gist:870190
Last active July 8, 2023 12:52
HTML5 Canvas - Rendering of Text on high-DPI screens
<html>
<head>
<script src='http://code.jquery.com/jquery-1.5.1.min.js'></script>
</head>
<body>
<h2>Naive canvas</h2>
<canvas id="naive" width="400" height="50"></canvas>
<h2>High-def Canvas</h2>
(setq evil-want-C-u-scroll t) ; Ctrl-u to scroll up
;; evil
(live-load-config-file "evil-conf.el")
;; evil-leader
(live-load-config-file "evil-leader-conf.el")
;; evil-surround
(live-load-config-file "evil-surround-conf.el")
@soply
soply / disp_multiple_images.py
Last active January 9, 2024 14:52
Plot multiple images with matplotlib in a single figure. Titles can be given optionally as second argument.
import matplotlib.pyplot as plt
import numpy as np
def show_images(images, cols = 1, titles = None):
"""Display a list of images in a single figure with matplotlib.
Parameters
---------
images: List of np.arrays compatible with plt.imshow.
@clwyatt
clwyatt / cntlc_tracer.cpp
Created November 12, 2018 14:33
An example program demonstrating how to handle signals
// This is an example of how to to trap Cntrl-C in a cross-platform manner
// it creates a simple REPL event loop and shows how to interrupt it.
#include <csignal>
#include <cstdlib>
// This global is needed for communication between the signal handler
// and the rest of the code. This atomic integer counts the number of times
// Cntl-C has been pressed by not reset by the REPL code.
volatile sig_atomic_t global_status_flag = 0;
@magickatt
magickatt / github_clone_using_token.sh
Created September 6, 2019 17:31
Clone a GitHub repository using a Personal Access Token
export GITHUB_USER=magickatt
export GITHUB_TOKEN=secret
export GITHUB_REPOSITORY=magickatt/ContainerisingLegacyApplicationsTalk
git clone https://${GITHUB_USER}:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}
@jamesmacfie
jamesmacfie / README.md
Created October 22, 2019 02:53
iTerm 2 - script to change theme depending on Mac OS dark mode

How to use

In iTerm2, in the menu bar go to Scripts > Manage > New Python Script

Select Basic. Select Long-Running Daemon

Give the script a decent name (I chose auto_dark_mode.py)

Save and open the script in your editor of choice.

@HViktorTsoi
HViktorTsoi / Argsort.cpp
Created June 21, 2020 07:23
C++ STL implementation of Argsort
#include <vector>
#include <algorithm>
/**
* Argsort(currently support ascending sort)
* @tparam T array element type
* @param array input array
* @return indices w.r.t sorted array
*/
template<typename T>
@JayPeet
JayPeet / OpenAI_Nginx_DenyList
Created September 4, 2024 20:48
Nginx OpenAI Deny List
# IPs taken from:
# https://openai.com/searchbot.json
# https://openai.com/chatgpt-user.json
# https://openai.com/gptbot.json
# And presumably could change.
location /
{
#deny OAI-SearchBot
deny 20.42.10.176/28;