Skip to content

Instantly share code, notes, and snippets.

Nemesis Fixx mcnemesis

Block or report user

Report or block mcnemesis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@johnhw
johnhw / umap_sparse.py
Last active Apr 20, 2020
1 million prime UMAP layout
View umap_sparse.py
### JHW 2018
import numpy as np
import umap
# This code from the excellent module at:
# https://stackoverflow.com/questions/4643647/fast-prime-factorization-module
import random
@radekk
radekk / entropy.js
Created Jun 7, 2017
Calculating Shannon's entropy with JavaScript
View entropy.js
/**
* Calculate Shannon's entropy for a string
*/
module.exports = (str) => {
const set = {};
str.split('').forEach(
c => (set[c] ? set[c]++ : (set[c] = 1))
);
@mcnemesis
mcnemesis / upgrade_wordpress_wpcli.sh
Last active Aug 29, 2015
This is how to upgrade your WordPress site, its plugins and themes automatically via a shell, using wp-cli
View upgrade_wordpress_wpcli.sh
#!/bin/bash
#requires: wp-cli installed
# run all the following commands inside your wordpress root directory
wp core update #updates wp itself
wp plugin update --all #update all plugins
wp theme update -all #update all themes
@mcnemesis
mcnemesis / uganda_districts.txt
Created Jun 4, 2014
List of all current (as of 2014) Uganda's Districts - useful in forms-authoring and other tasks of your liking (source : http://www.statoids.com/uug.html)
View uganda_districts.txt
Abim
Adjumani
Agago
Alebtong
Amolatar
Amudat
Amuria
Amuru
Apac
Arua
View domain-nginx.conf
server {
server_name $domain_name;
root /var/www;
index index.html index.php;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;
# Cache static files for as long as possible
location ~* \.(?:xml|ogg|mp3|mp4|ogv|svg|svgz|eot|otf|woff|ttf|css|js|jpg|jpeg|gif|png|ico)$ {
try_files $uri =404;
View Python PyCrypto: Verify Signature Example.py
def verify_sign(public_key_loc, signature, data):
'''
Verifies with a public key from whom the data came that it was indeed
signed by their private key
param: public_key_loc Path to public key
param: signature String signature to be verified
return: Boolean. True if the signature is valid; False otherwise.
'''
from Crypto.PublicKey import RSA
from Crypto.Signature import PKCS1_v1_5
@willurd
willurd / web-servers.md
Last active May 28, 2020
Big list of http static server one-liners
View web-servers.md

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@justincarroll
justincarroll / bootstrap-basic-template.htm
Last active May 11, 2018
This is my personal Bootstrap 3 and Font Awesome 4 basic HTML template.
View bootstrap-basic-template.htm
<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Bootstrap Basic Template</title>
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.2.0/css/font-awesome.min.css">
<link rel="stylesheet" href="style.css">
@mems
mems / gist:5301297
Last active Apr 23, 2020
How to convert a (simple) SWF to PDF
View gist:5301297

Convert (simple) SWF to PDF

In SWFTools a programs called gfx2gfx is available to do this task, but it's not officially available precompiled.

It can convert SWF, PDF or image to SWF, PDF, ebook or image.

For discard downscaling for rasterized image (default: 72dpi) we use the provided by @m-p-y: add -r attribute to increase maxdpi

Requirements

You can’t perform that action at this time.