Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View NixImagery's full-sized avatar

Nick Hood NixImagery

View GitHub Profile
@NixImagery
NixImagery / Missing pandoc defaults file.md
Last active April 15, 2024 08:57
pandoc throws "file not found" for defaults.yml

Occurs in visual studio code, using pandoc citer extension. Typing '@' in the editor throws an error, reporting the file 'default.yml' is missing.

Resolution is to provide the file. First, find the pandoc data directory:

% pandoc -v
pandoc 3.1.12.3
Features: +server +lua
Scripting engine: Lua 5.4
User data directory: /Users/dave/.local/share/pandoc
""" A Python script to walk a directory tree, renaming .jpg and .JPG files.
Written for a client who had a directory containing multiple directories, each containing
zero or more (up to 100) image files. Most of the images were named abitrary1.jpg or arbitrary2.JPG.
The clinet wanted each folder's images to be numbered 001.jpg to nnn.jpg for some further process.
nick@cullaloe.net
Available under the MIT License:
Copyright (c) 2018 Nick Hood
using namespace std;
int main(){
int t;
cin >> t;
// Using sieve of Eratosthenes, from Wikipedia
bool primes[1000001]; // Let A be an array of Boolean values,
fill_n(primes, 1000001, true); // indexed by integers 2 to n, initially all set to true.
for (long i = 2; i <= 1000; ++i) // i = 2, 3, 4, ..., not exceeding root n:
if (primes[i]) // if A[i] is true:
using namespace std;
int main(){
int t;
cin >> t;
for(int a0 = 0; a0 < t; a0++){
int n;
int b, c;
long abc;
using namespace std;
int main(){
vector<int> pn{1, 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97, 101, 103, 107, 109, 113, 127, 131, 137, 139, 149, 151, 157, 163, 167, 173, 179, 181, 191, 193, 197, 199};
vector<int> pn2{pn};
int t;
cin >> t;
for(int a0 = 0; a0 < t; a0++){
int n;
int main(){
int t;
cin >> t;
vector<long> p;
for (int a=100001; a < 900010; a+=100001)
for (int b = 0; b < 90091; b+=10010)
for (int c = 0; c < 9901; c+=1100)
p.push_back(a + b + c);
sort(p.begin(), p.end());
p.push_back (0);
@NixImagery
NixImagery / 0_reuse_code.js
Created April 26, 2017 13:45
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@NixImagery
NixImagery / gist:b0342a79e465ba0beaa0321b27372161
Created October 18, 2016 06:58
Verifying that "cullaloe.id" is my Blockstack ID. https://onename.com/cullaloe
Verifying that "cullaloe.id" is my Blockstack ID. https://onename.com/cullaloe
Flash cookies are stored in:
~/Library/Preferences/Macromedia/Flash Player/#SharedObjects
~/Library/Preferences/Macromedia/Flash Player/macromedia.com/support/flashplayer/sys/
~/Library/Application Support/Google/Chrome/Default/Pepper Data/Shockwave Flash/WritableRoot/#SharedObjects/
Adobe Air cookies are stored in:
~/Library/Preferences/AIR App Name/Local Store/#SharedObjects/flash file.swf/flash object.sol
@NixImagery
NixImagery / gist:1df4b4b0f57daf2c693facfc7ded1bec
Created October 14, 2016 14:15
Crontab for a twitterbot
0,5,10,15,20,25,30,35,40,45,50,55 * * * * cd /var/www/vhosts/cullaloe.hostinguk.org/sptr && php -q /var/www/vhosts/cullaloe.hostinguk.org/sptr/tweet.php >/dev/null