Skip to content

Instantly share code, notes, and snippets.

View leeoniya's full-sized avatar
😕
shaving bytes and milliseconds. dependencies: {}

Leon Sorokin leeoniya

😕
shaving bytes and milliseconds. dependencies: {}
View GitHub Profile

Use Linode's DNS Manager API for one-line dynamic DNS

This can be useful for cron, for instance.

Prereqs

  • You are using Linode's DNS Manager to manage a zone for your domain
  • You have already created an A record for the name you want to make dynamic
  • You have an API key for Linode's API
  • curl and jsonpp (jsonpp is not necessary but makes the manual steps easier)
@leeoniya
leeoniya / snowden-ietf93.md
Last active September 8, 2015 04:26 — forked from mnot/snowden-ietf93.md
Transcript of Edward Snowden's comments at IETF93.
@leeoniya
leeoniya / README
Created August 12, 2011 18:13 — forked from joelambert/README
Drop in replacements for setTimeout()/setInterval() that makes use of requestAnimationFrame() where possible for better performance
Drop in replace functions for setTimeout() & setInterval() that
make use of requestAnimationFrame() for performance where available
http://www.joelambert.co.uk
Copyright 2011, Joe Lambert.
Free to use under the MIT license.
http://www.opensource.org/licenses/mit-license.php
@leeoniya
leeoniya / gist:64c6d859e0ebd0a3f945f02669a9b624
Created July 2, 2017 13:56 — forked from micho/gist:728639
Throttle and debounce examples
// Run the function as soon as it's called, but prevent further calls during `delay` ms
// Example: function.throttle(200) will only run function() once every 200 ms.
// Useful, for example, to avoid constant processing while typing in a live search box.
Function.prototype.throttle = function(delay) {
var fn = this
return function() {
var now = (new Date).getTime()
if (!fn.lastExecuted || fn.lastExecuted + delay < now) {
fn.lastExecuted = now
fn.apply(fn, arguments)
@leeoniya
leeoniya / key.md
Created December 21, 2019 14:16
Twitter (un)official Consumer Key

Twitter Official Consumer Key

Twitter for Android

type:            PIN
Consumer key:    3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for iPhone

type:            PIN

Consumer key: IQKbtAYlXLripLGPWd0HUA

@leeoniya
leeoniya / twittermute.txt
Created January 25, 2020 01:22 — forked from IanColdwater/twittermute.txt
Here are some terms to mute on Twitter to clean your timeline up a bit.
Mute these words in your settings here: https://twitter.com/settings/muted_keywords
ActivityTweet
generic_activity_highlights
generic_activity_momentsbreaking
RankedOrganicTweet
suggest_activity
suggest_activity_feed
suggest_activity_highlights
suggest_activity_tweet
@leeoniya
leeoniya / plink-plonk.js
Created February 18, 2020 07:27 — forked from tomhicks/plink-plonk.js
Listen to your web pages
@leeoniya
leeoniya / README.md
Created April 19, 2020 20:34 — forked from bluesmoon/README.md
Pseudo-Random number generator that follows a Normal or Log-Normal distribution.

Marsaglia-polar.js

This script generates random numbers along a Normal or Log-normal distribution using the Marsaglia polar method.

There are four functions you can use:

  • normalRandom: Generate random numbers that follow a Normal distribution.
  • normalRandomInRange: Generate random numbers that follow a Normal distribution but are clipped to fit within a range
  • normalRandomScaled: Generate random numbers that follow a Normal distribution with a given mean and standard deviation
  • lnRandomScaled: Generate random numbers that follow a Log-normal distribution with a given geometric mean and geometric standard deviation
@leeoniya
leeoniya / st4-changelog.md
Created April 8, 2021 22:48 — forked from jfcherng/st4-changelog.md
Sublime Text 4 changelog just because it's not on the official website yet.

Converted via https://domchristie.github.io/turndown

Sublime Text/Merge 中文 Telegram 交流群組: https://t.me/sublime_tw

About Sublime Text 4

ST 4 is currently under private alpha for power users to test and report issues to let the dev team make it polished before it gets publicly announced. It has been under alpha for over 1 year already and it's actually kind of stable for daily use now. If you have a ST 3 license, you can join the offical ST Discord chat server to download and test it. And the most important thing, report issues you encoutered so ST 4 can become better. I hope people can interact with the dev team more so I don't directly put download links here but maybe you are smart enough to guess them :)

Dev Channel Changelog

@leeoniya
leeoniya / sortArrays.js
Created July 2, 2021 03:18 — forked from boukeversteegh/sortArrays.js
Sorting multiple arrays in Javascript
/**
* Sorts all arrays together with the first. Pass either a list of arrays, or a map. Any key is accepted.
* Array|Object arrays [sortableArray, ...otherArrays]; {sortableArray: [], secondaryArray: [], ...}
* Function comparator(?,?) -> int optional compareFunction, compatible with Array.sort(compareFunction)
*/
function sortArrays(arrays, comparator = (a, b) => (a < b) ? -1 : (a > b) ? 1 : 0) {
let arrayKeys = Object.keys(arrays);
let sortableArray = Object.values(arrays)[0];
let indexes = Object.keys(sortableArray);
let sortedIndexes = indexes.sort((a, b) => comparator(sortableArray[a], sortableArray[b]));