Skip to content

Instantly share code, notes, and snippets.

View sebble's full-sized avatar

Sebastian Mellor sebble

  • Sebble.com
  • Newcastle upon Tyne
View GitHub Profile
#!/usr/bin/python
"""
This script can quickly reformat a BuildAX CSV file to unix timestamp,
excluding tx power and PIR counts
In: 2015/05/15,14:51:56,427A538D,-44,2,34,20,3225,30.74,231,0,30,30367,1
Out: 1431697916,427A538D,-44,2,34,3225,30.74,23.1,0,30367,1
"""
import re
import sys
from __future__ import print_function
import numpy as np
from xlwings import Workbook, Range
#Deep excel not included please find it here: http://www.deepexcel.net/
def run_test_data():
with open('test.csv','rt') as f:
with open('result.csv','wt') as r:
@fta2012
fta2012 / ReplicatedRandomChrome.js
Last active May 17, 2024 02:24
EDIT: This code no longer works on chrome but still works for legacy versions of node. Updated code moved to https://github.com/fta2012/ReplicatedRandom/tree/master/node.
var rngstate;
function MathRandom() {
// Our own implementation of Math.random().
// Source code was copied from https://github.com/v8/v8/blob/4.6.85/src/math.js#L131
// You need to initialize rngstate with `solve` before this can be used.
// If using node.js, you have to s/18030/18273/g here and in `solve` since they implement it slightly differently: https://github.com/nodejs/node-v0.x-archive/blob/d13d7f74d794340ac5e126cfb4ce507fe0f803d5/deps/v8/src/math.js#L146
console.assert(rngstate, "You need to set the global variable `rngstate` first. For example: `rngstate = solve(Math.random(), Math.random());`");
if (!rngstate) return;
var r0 = (Math.imul(18030, rngstate[0] & 0xFFFF) + (rngstate[0] >>> 16)) | 0;
rngstate[0] = r0;
@jdoconnor
jdoconnor / gist:32ef0314cecb80157c4e
Created September 26, 2014 21:38
Update mtimes based off commit time
#!/bin/bash -e
####
# based on https://gist.github.com/jeffery/1115504
# Helper script to update the Last modified timestamp of files in a Git SCM
# Projects working Copy
#
# When you clone a Git repository, it sets the timestamp of all the files to the
# time when you cloned the repository.
#
# This becomes a problem when you want the cloned repository, which is part of a
@kyledrake
kyledrake / ferengi-plan.txt
Last active April 6, 2024 00:30
How to throttle the FCC to dial up modem speeds on your website using Nginx
# The blog post that started it all: https://neocities.org/blog/the-fcc-is-now-rate-limited
#
# Current known FCC address ranges:
# https://news.ycombinator.com/item?id=7716915
#
# Confirm/locate FCC IP ranges with this: http://whois.arin.net/rest/net/NET-165-135-0-0-1/pft
#
# In your nginx.conf:
location / {
@cscorley
cscorley / jekyll.py
Last active January 9, 2021 21:47
IPython to Jekyll Markdown
try:
from urllib.parse import quote # Py 3
except ImportError:
from urllib2 import quote # Py 2
import os
import sys
BLOG_DIR = os.environ['BLOG_DIR']
# BLOG_DIR = '/Users/cscorley/git/cscorley.github.io/'
@boynux
boynux / lxc-centos
Last active December 31, 2015 05:59 — forked from hagix9/lxc-centos
#!/bin/bash
#
# template script for generating CentOS container for LXC
#
#
# lxc: linux Container library
# Authors:
@mariuz
mariuz / emperor.sh
Last active August 26, 2020 12:59
uwsgi emperor init script for debian 7.x
#!/usr/bin/env bash
### BEGIN INIT INFO
# Provides: emperor
# Required-Start: $all
# Required-Stop: $all
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the uwsgi emperor app server
# Description: starts uwsgi emperor app server using start-stop-daemon
@plentz
plentz / nginx.conf
Last active May 17, 2024 09:08
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048