Skip to content

Instantly share code, notes, and snippets.

View gu-stav's full-sized avatar
🍿

Gustav Hansen gu-stav

🍿
View GitHub Profile
@gu-stav
gu-stav / settimeout.js
Last active March 16, 2017 15:17 — forked from gtrufitt/settimeout.js
Test setTimouet
console.log('first script start');
function sleep(milliSeconds){
var startTime = new Date().getTime(); // get the current time
while (new Date().getTime() < startTime + milliSeconds); // hog cpu until time's up
}
sleep(2000)
console.log('first script end');

Notes from Coed:Ethics conference, London, 13 July 2018

Cori Crider - "When data kills" / Weaponised AI

  • Imam Salem bin Ali Jaber preached in Yemen against Islamic extremism; guest at a wedding of relative; hit by a US Hellfire missile fired from a drone. Relative Faisal made contact with Cori, went to Washington DC. No explanation ever made by government (although compensation was paid).
  • Decision-making process behind the attack not known exactly. But there is significant evidence that such attacks serve to further radicalise people; attack results in ~3x more new recruits than extremists killed by attack.
  • Most drone attacks are not on named individuals, but rather "signature strikes" — a euphemism for killing people the military doesn't even know, but who match a certain behavioural pattern (perhaps based on metadata — Hayden: "we kill people based on metadata"
  • Skynet (known through Snowden relevations): use machine learning to try to find courier
@gu-stav
gu-stav / parseLocaleNumber.js
Last active August 9, 2021 08:20
Parse a number-like string to a locale aware Number
const parseLocaleNumber = (input, locale) => {
const formatter = Intl.NumberFormat(locale);
const [, { value: thousandSeparator }] = formatter.formatToParts(11111);
const [, { value: decimalSeparator }] = formatter.formatToParts(1.1);
return parseFloat(input
.replace(new RegExp('\\' + thousandSeparator, 'g'), '')
.replace(new RegExp('\\' + decimalSeparator), '.')
);
}
<details>
<summary>yarn@v3</summary>
```
➤ YN0000: ┌ Resolution step
➤ YN0032: │ better-sqlite3@npm:8.0.1: Implicit dependencies on node-gyp are discouraged
➤ YN0061: │ request@npm:2.88.2 is deprecated: request has been deprecated, see https://github.com/request/request/issues/3142
➤ YN0061: │ uuid@npm:3.4.0 is deprecated: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
➤ YN0061: │ har-validator@npm:5.1.5 is deprecated: this library is no longer supported
➤ YN0032: │ fsevents@npm:2.3.2: Implicit dependencies on node-gyp are discouraged