Skip to content

Instantly share code, notes, and snippets.

View osde8info's full-sized avatar

Clive D osde8info

View GitHub Profile
@osde8info
osde8info / .prettierrc
Created January 12, 2020 08:11
prettierrc (my favorite settings)
{
"overrides": [
{
"files": ".prettierrc",
"options": { "parser": "json" }
}
],
"quoteProps": "consistent",
"semi": false,
"singleQuote": true,
@osde8info
osde8info / index.html
Last active January 10, 2020 11:56
SLOW CSS RAIN
<section class="rain"></section>
@osde8info
osde8info / longlattozxy.js
Created December 31, 2019 19:06
long lat to osm zxy converter
function long2tile(lon,zoom) { return (
Math.floor((lon+180)/360*Math.pow(2,zoom))); }
function lat2tile(lat,zoom) { return (
Math.floor((1-Math.log(Math.tan(lat*Math.PI/180) + 1/Math.cos(lat*Math.PI/180))/Math.PI)/2 *Math.pow(2,zoom))); }
console.log(long2tile(51.1,12)+' '+lat2tile(0.1,12)
@osde8info
osde8info / deptree-json-sync.js
Created May 14, 2019 15:08 — forked from json2d/deptree-json-sync.js
Walk through dependency tree of installed packages via `npm ls`
const spawn = require('cross-spawn');
const path = require('path')
const ls = spawn.sync('npm', ['ls','--json']);
const tree = JSON.parse(ls.stdout)
const walkDepTree = (tree,cb) => {
const deps = tree.dependencies
if(deps) {
@osde8info
osde8info / yahooapioauth
Created May 12, 2019 13:18
yahoo api oauth example with secret keys from dotenv
require('dotenv').config();
var OAuth = require('oauth');
var request = new OAuth.OAuth(
null,
null,
process.env.MY_YAHOO_API_KEY,
process.env.MY_YAHOO_API_SECRET,
'1.0',
@osde8info
osde8info / yahoo.js
Created May 12, 2019 12:16
yahoo api node oauth example
// require('secrets');
var OAuth = require('oauth');
var request = new OAuth.OAuth(
null,
null,
MyKey,
MySecret,
'1.0',
@osde8info
osde8info / rsync.sh
Created April 11, 2018 14:29
rsync leaving destination owner and group intact
rsync -cav --no-o --no-g srcdir1 srcdir2 remoteuser@remotehost:/var/www/html
@osde8info
osde8info / gist:1b0cc8091937f3fb14c46f4b23633fec
Created March 13, 2018 11:43
create a bootable usb from an .iso with dd
# dd status=progress if=linux-lite-3.8-32bit.iso of=/dev/sdb bs=4M
@osde8info
osde8info / phpassoc2xml
Created December 20, 2015 13:37
php assoc array to xml and json serialiser
<?php
// SETUP PHP ARRAY USING HARDCODED JSON INSTEAD OF HARDCODED PHP
include 'q.php';
// ACTUAL ASSOC ARRAY TO XML & JSON SERIALISATION STARTS HERE
function aatoxml($xml,$ele) {
if (is_array($ele)) {
@osde8info
osde8info / mysqldump tables
Last active December 9, 2015 17:01
mysqldump tables
mysqldump tables into separate files
assuming user and pass are defined in .my.cnf
$ mysqldump -h myhost --skip-lock-tables --compact --extended-insert --max_allowed_packet=64M --tab=dir_name