Skip to content

Instantly share code, notes, and snippets.

Avatar

A.A monolithed

View GitHub Profile
@monolithed
monolithed / strace.md
Created Aug 14, 2018 — forked from graste/strace.md
strace process for network and memory and other syscalls
View strace.md

File activity

strace -e trace=file -fp PID (file) or strace -e trace=desc -fp PID (file descriptors)

Common calls:

  • access
  • close – close file handle
  • fchmod – change file permissions
  • fchown – change file ownership
View html5-video-streamer.js
/*
* Inspired by: http://stackoverflow.com/questions/4360060/video-streaming-with-html-5-via-node-js
*/
var http = require('http'),
fs = require('fs'),
util = require('util');
http.createServer(function (req, res) {
var path = 'video.mp4';
View index.js
// Usage
<Router>
<Provider store={store}>
<ListeningRouter>
<Main />
</ListeningRouter>
</Provider>
</Router>
@monolithed
monolithed / file.js
Created Apr 24, 2017 — forked from alexcorvi/file.js
JSX without react
View file.js
var React = {
createElement: function (tag, attrs, children) {
var e = document.createElement(tag);
// Add attributes
for (var name in attrs) {
if (name && attrs.hasOwnProperty(name)) {
var v = attrs[name];
if (v === true) {
e.setAttribute(name, name);
View openssl pkcs8 -topk8 -nocrypt -in privkey.pem -out privkey2.pem 76
openssl genrsa -out privkey.pem 768
openssl pkcs8 -topk8 -nocrypt -in privkey.pem -out privkey2.pem
View colortext.svg
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@monolithed
monolithed / index.html
Last active Feb 1, 2017 — forked from iketari/index.html
Object.keys vs for..in #jsbench #jsperf (http://jsbench.github.io/#9edc79f26350c0e90d8dddb48dc19f31) #jsbench #jsperf
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8"/>
<title>Object.keys vs for..in #jsbench #jsperf</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/benchmark/1.0.0/benchmark.min.js"></script>
<script src="./suite.js"></script>
</head>
<body>
<h1>Open the console to view the results</h1>
@monolithed
monolithed / nginx.conf
Created Dec 24, 2015 — forked from micho/nginx.conf
nginx config for http/https proxy to localhost:3000
View nginx.conf
First, install nginx for mac with "brew install nginx".
Then follow homebrew's instructions to know where the config file is.
1. To use https you will need a self-signed certificate: https://devcenter.heroku.com/articles/ssl-certificate-self
2. Copy it somewhere (use full path in the example below for server.* files)
3. sudo nginx -s reload
4. Access https://localhost/
Edit /usr/local/etc/nginx/nginx.conf:
@monolithed
monolithed / index.js
Created Dec 7, 2015 — forked from lygaret/index.js
ES6 Quasi-Literal for JSX
View index.js
define(function(require) {
var React = require('react');
var paramRegex = /__(\d)+/;
var parser = new DOMParser();
var errorDoc = parser.parseFromString('INVALID', 'text/xml');
var errorNs = errorDoc.getElementsByTagName("parsererror")[0].namespaceURI;
// turns the array of string parts into a DOM
// throws if the result is an invalid XML document.
@monolithed
monolithed / gist:7a0ffc4e94ffc62dee84
Last active Sep 11, 2015 — forked from yano3/gist:1378948
git commit --amend --reset-author
View gist:7a0ffc4e94ffc62dee84
Your name and email address were configured automatically based
on your username and hostname. Please check that they are accurate.
You can suppress this message by setting them explicitly:
git config --global user.name "Your Name"
git config --global user.email you@example.com
After doing this, you may fix the identity used for this commit with:
git commit --amend --reset-author