Skip to content

Instantly share code, notes, and snippets.

View calebkiage's full-sized avatar

Caleb Kiage calebkiage

  • Nairobi
  • 22:58 (UTC +03:00)
View GitHub Profile
@calebkiage
calebkiage / ascii-number-to-int.js
Created January 31, 2021 23:13
Converts ASCII numbers to Integers using Logical AND
const buffer = Buffer.from("9999999999", "ascii");
const mask = 15; // 00001111
let result = 0;
for (let i = 0; i < buffer.length; i++) {
const place = 1 * (10 ** i);
const pos = (buffer.length - i) - 1;
result += (buffer[pos] & mask) * place;
@calebkiage
calebkiage / index2.html
Last active December 24, 2019 20:14
Getting Started with Vue.js
<!DOCTYPE html>
<html>
<head>
<title>Getting Started with Vue.js</title>
</head>
<body>
<div id="my-app">
{{message}}
</div>
@calebkiage
calebkiage / index1.html
Last active December 24, 2019 19:47
Getting Started with Vue.js
<!DOCTYPE html>
<html>
<head>
<title>Getting Started with Vue.js</title>
</head>
<body>
<p>Empty html</p>
<!-- development version of vue, includes helpful console warnings -->
@calebkiage
calebkiage / index0.html
Last active December 24, 2019 19:47
Getting Started with Vue.js start
<!DOCTYPE html>
<html>
<head>
<title>Getting Started with Vue.js</title>
</head>
<body>
<p>Empty html</p>
</body>
</html>
@calebkiage
calebkiage / web-servers.md
Created May 5, 2017 08:46 — forked from willurd/web-servers.md
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
@calebkiage
calebkiage / svg2ico.sh
Created January 28, 2017 02:32 — forked from azam/svg2ico.sh
Convert SVG to ICO using ImageMagick, with transparent background and multi-size icons
convert -density 384 -background transparent favicon.svg -define icon:auto-resize -colors 256 favicon.ico
# http://wiki.apache.org/solr/FAQ#How_can_I_delete_all_documents_from_my_index.3F
# http://wiki.apache.org/solr/UpdateXmlMessages#Updating_a_Data_Record_via_curl
curl http://index.websolr.com/solr/a0b1c2d3/update -H "Content-Type: text/xml" --data-binary '<delete><query>*:*</query></delete>'