Skip to content

Instantly share code, notes, and snippets.

View dimorphic's full-sized avatar
🤖
*void 0*

Sabin Tudor dimorphic

🤖
*void 0*
View GitHub Profile
@dimorphic
dimorphic / osx-file-limit.sh
Created October 11, 2018 14:00
OSX increase file limit
echo kern.maxfiles=65536 | sudo tee -a /etc/sysctl.conf
echo kern.maxfilesperproc=65536 | sudo tee -a /etc/sysctl.conf
sudo sysctl -w kern.maxfiles=65536
sudo sysctl -w kern.maxfilesperproc=65536
ulimit -n 65536 65536
echo "ulimit -n 65536 65536" >> .bashrc
source .bashrc
@dimorphic
dimorphic / giphy-api.js
Created September 28, 2018 08:30
Giphy.com API fetch
// https://github.com/dimorphic/bitch.pizza/blob/master/src/js/get-giphy.js
// Get your key @ https://developers.giphy.com/
const GIPHY_API_KEY = '<KEY-HERE>'; // random key. Get your own!
// Giphy API defaults
const API = {
baseURL: 'https://api.giphy.com/v1/',
resource: 'gifs',
key: GIPHY_API_KEY,
@dimorphic
dimorphic / lazy-man-url-parser.js
Created May 9, 2018 08:19
lazy man url parser
let parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@dimorphic
dimorphic / tsconfig.json
Created December 29, 2017 12:42
ts-config-default.json
{
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"lib": [
"dom",
"es2015",
"es2016"
@dimorphic
dimorphic / provision-aws-ec2.sh
Last active September 14, 2017 19:22
AWS EC2 provision template bash script
#!/bin/bash
function eco {
echo "====================================="
echo $1
echo "====================================="
}
# Settings
export USER_DIR=/home/ec2-user
export NODE_VERSION=v8.4.0 # Node.js version to install
@dimorphic
dimorphic / index.html
Created August 30, 2017 21:21 — forked from stesie/index.html
AWS IoT-based serverless JS-Webapp Pub/Sub demo
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>AWS IoT Pub/Sub Demo</title>
</head>
<body>
<h1>AWS IoT Pub/Sub Demo</h1>
<form>
<button type="button" id="connect">connect!</button>
@dimorphic
dimorphic / once-decorator.ts
Created February 10, 2017 11:12
once decorator
import {Subscriber} from "rxjs";
export function Once(milliseconds: number = 0) {
return function (target, key, descriptor) {
var originalMethod = descriptor.value;
descriptor.value = function (...args) {
var sub = originalMethod.apply(this, args);
setTimeout(() => {
if (sub instanceof Subscriber) {
sub.unsubscribe();
@dimorphic
dimorphic / timeout-decorator.ts
Created February 10, 2017 11:11
timeout decorator
// ref: http://blog.wolksoftware.com/decorators-reflection-javascript-typescript
// ref: https://medium.com/@NetanelBasal/javascript-make-your-code-cleaner-with-decorators-d34fc72af947#.fe9f2rfb8
export function timeout( milliseconds: number = 0 ) {
return function( target, key, descriptor ) {
var originalMethod = descriptor.value;
descriptor.value = function (...args) {
@dimorphic
dimorphic / blob-filereader-localStorage.js
Created December 28, 2016 16:05 — forked from robnyman/blob-filereader-localStorage.js
Get file as a blob, read through FileReader and save in localStorage
// Getting a file through XMLHttpRequest as an arraybuffer and creating a Blob
var rhinoStorage = localStorage.getItem("rhino"),
rhino = document.getElementById("rhino");
if (rhinoStorage) {
// Reuse existing Data URL from localStorage
rhino.setAttribute("src", rhinoStorage);
}
else {
// Create XHR and FileReader objects
var xhr = new XMLHttpRequest(),
@dimorphic
dimorphic / asus-sabertooth-z170-mark1-4.5ghz.txt
Created December 3, 2016 21:44
ASUS SABERTOOTH Z170 MARK 1 - 4.5Ghz OC cpu / ram ?
Am revenit cu setarile din bios pentru i7-6700k la 4,5 ghz si ram Corsair DDR4 la 3200 Mhz;
Inainte totusi un mic disclaimer: aceste setari de mai jos merg la mine, nu inseamna neaparat ca vor merge pe toate sistemele cu i7 6700k; depinde din ce lot de fabricatie ati nimerit procesorul, de tipul de ram si bineinteles de versiunea de bios;
Iata setarile pentru bios versiunea 1801 pe aceasta placa de baza asa cum le-am gasit eu stabile dupa 5-6 saptamani de testari:
AI OVERCLOCK TUNER - Manual
BCLK Frequency - 100.00
ASUS MULTICORE ENHANCEMENT - Disabled
CPU CORE RATIO - SYNC ALL Cores
1-Core Ratio Limit - 45 (adica frecventa 4,5 ghz)