Skip to content

Instantly share code, notes, and snippets.

View mcnemesis's full-sized avatar
💭
DNAP hackathons on days with good weather ;-)

Nemesis Fixx Da JWL mcnemesis

💭
DNAP hackathons on days with good weather ;-)
View GitHub Profile
@willurd
willurd / web-servers.md
Last active March 26, 2024 18:11
Big list of http static server one-liners

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
@ragingwind
ragingwind / Backend Architectures Keywords and References.md
Last active March 11, 2024 19:13
Backend Architectures Keywords and References
@johnhw
johnhw / umap_sparse.py
Last active January 6, 2024 16:09
1 million prime UMAP layout
### 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
@rg089
rg089 / stopwords.txt
Created July 15, 2021 14:48
A List of English Stopwords
0o
0s
3a
3b
3d
6b
6o
a
a1
a2
@francisnnumbi
francisnnumbi / LineNumberedEditText
Created May 16, 2017 08:32
implementing an EditText with line number on the left. What is new is: - get/set line number margin gap - set line number visible - set line number color Everything is done in the overridden onDraw() method.
import android.widget.*;
import android.util.*;
import android.content.*;
import android.graphics.*;
/**
* the simple implementation of an EditText where each line is numbered on the left
*/
public class LineNumberedEditText extends EditText {
@radekk
radekk / entropy.js
Created June 7, 2017 18:16
Calculating Shannon's entropy with JavaScript
/**
* Calculate Shannon's entropy for a string
*/
module.exports = (str) => {
const set = {};
str.split('').forEach(
c => (set[c] ? set[c]++ : (set[c] = 1))
);
package com.nuchwezi.nulabs;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import com.nuchwezi.xlitedatabase.DBAdapter; // <-- get the DAL
@sergeifilippov
sergeifilippov / domain-nginx.conf
Created February 10, 2014 03:22
linux-dash with nginx
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;
@cachapa
cachapa / gif_creator.sh
Last active April 1, 2022 12:07
Shell script to generate high-quality animated gifs from a video file
#!/bin/bash
# Based on http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
# Requires ffmpeg
filename="${1%.*}"
palette="/tmp/palette.png"
filters="scale=320:-1:flags=lanczos"
ffmpeg -v warning -i "$1" -vf "$filters,palettegen" -y $palette
ffmpeg -v warning -i "$1" -i $palette -lavfi "$filters [x]; [x][1:v] paletteuse" -y "$filename.gif"
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