Skip to content

Instantly share code, notes, and snippets.

Avatar

Nick Hood NixImagery

View GitHub Profile
View rename.py
""" 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
View HR_cpp_Euler10.cpp
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:
View HR_cpp_Euler9.cpp
using namespace std;
int main(){
int t;
cin >> t;
for(int a0 = 0; a0 < t; a0++){
int n;
int b, c;
long abc;
View HR_cpp_Euler7.cpp
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;
View HR_cpp_Euler4.cpp
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 Apr 26, 2017
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View gist:b0342a79e465ba0beaa0321b27372161
Verifying that "cullaloe.id" is my Blockstack ID. https://onename.com/cullaloe
View gist:dd8308ac730d4e93654b18b5ce28bff9
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
View gist:1df4b4b0f57daf2c693facfc7ded1bec
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
@NixImagery
NixImagery / gist:82bb7b0d5bca363ead17778e447581f6
Last active Oct 16, 2016
Verifying that "cullaloe.id" is my Blockstack ID. https://onename.com/cullaloe
View gist:82bb7b0d5bca363ead17778e447581f6
Verifying that "cullaloe.id" is my Blockstack ID. https://onename.com/cullaloe