Skip to content

Instantly share code, notes, and snippets.

View d4tocchini's full-sized avatar

Dan Tocchini IV d4tocchini

View GitHub Profile
<ul>
{{#tweets}}
<li>{{text}}</li>
{{/tweets}}
</ul>
// Original code from http://www.blog.highub.com/mobile-2/a-fix-for-iphone-viewport-scale-bug/
var metas = document.getElementsByTagName('meta');
var i;
if (navigator.userAgent.match(/iPhone/i)) {
for (i=0; i<metas.length; i++) {
if (metas[i].name == "viewport") {
metas[i].content = "width=device-width, minimum-scale=1.0, maximum-scale=1.0";
}
}
@19h
19h / pairingfunction.js
Last active November 12, 2018 20:08
Pairing Function for Javascript. Combines two numbers into one; used for compression of analytics data where two coordinates of mouse-clicks are combined into a single integer.
var pair = function (x, y) {
return x << 16 & 0xffff0000 | y & 0x0000ffff;
};
var depair = function (p) {
return [p >> 16 & 0xFFFF, p & 0xFFFF]
};
@yamnikov-oleg
yamnikov-oleg / LICENSE
Last active January 14, 2025 10:58
Shared (interprocess) mutexes on Linux
MIT License
Copyright (c) 2018 Oleg Yamnikov
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
@aviaryan
aviaryan / zsh-on-windows.md
Last active February 9, 2024 03:22
Installing zsh and oh-my-zsh on Windows
  1. Install zsh from cygwin
  2. Install oh-my-zsh from https://github.com/robbyrussell/oh-my-zsh . Follow the manual instructions
  3. To make zsh default on ConEmu, create a task with C:\cygwin64\bin\mintty.exe /usr/bin/zsh - . Make it the defaut shell.
  4. To start a zsh shell on demand, add this batch script to your path or start menu or wherever.
start C:\cygwin64\bin\mintty.exe /usr/bin/zsh -
@iosecure
iosecure / iOS, The Future Of macOS, Freedom, Security And Privacy In An Increasingly Hostile Global Environment.md
Last active November 28, 2024 02:18
iOS, The Future Of macOS, Freedom, Security And Privacy In An Increasingly Hostile Global Environment

iOS, The Future Of macOS, Freedom, Security And Privacy In An Increasingly Hostile Global Environment

This post by a security researcher who prefers to remain anonymous will elucidate concerns about certain problematic decisions Apple has made and caution about future decisions made in the name of “security” while potentially hiding questionable motives. The content of this article represents only the opinion of the researcher. The researcher apologises if any content is seen to be inaccurate, and is open to comments or questions through PGP-encrypted mail.



TL;DR

@nicowilliams
nicowilliams / fork-is-evil-vfork-is-good-afork-would-be-better.md
Last active March 14, 2025 02:50
fork() is evil; vfork() is goodness; afork() would be better; clone() is stupid

I recently happened upon a very interesting implementation of popen() (different API, same idea) called popen-noshell using clone(2), and so I opened an issue requesting use of vfork(2) or posix_spawn() for portability. It turns out that on Linux there's an important advantage to using clone(2). I think I should capture the things I wrote there in a better place. A gist, a blog, whatever.

This is not a paper. I assume reader familiarity with fork() in particular and Unix in general, though, of course, I link to relevant wiki pages, so if the unfamiliar reader is willing to go down the rabbit hole, they should be able to come ou

@lattner
lattner / TaskConcurrencyManifesto.md
Last active April 22, 2025 01:00
Swift Concurrency Manifesto
@htfy96
htfy96 / osuperfast.md
Last active January 4, 2021 09:41
-Osuperfast: gcc optimization flags used in our project
CXXFLAGS="-ffast-math -fdevirtualize-speculatively  -fassociative-math -freciprocal-math -fno-signed-zeros -fno-trapping-math -fipa-pta -mrecip=all -fgcse-sm -fgcse-las -fgcse-after-reload -march=native  -ftree-vectorize -floop-interchange -floop-block -ftree-coalesce-vars -floop-nest-optimize -fgraphite-identity -ftree-loop-ivcanon -fivopts" LDFLAGS="-ffast-math -fdevirtualize-speculatively"

Benchmark

Basic O3 + -march=native

rendering time = 91ms

Basic O3 + -march=native + -ffast-math + -mrecip=all

rendering time = 92ms

@bricewge
bricewge / Caddyfile
Created February 23, 2019 10:41
Deploying hugo blog with caddy
localhost:8080 {
root ./my-site
internal .repo
git {
repo https://github.com/kaushalmodi/hugo-bare-min-theme.git
path .repo
clone_args --depth 1 --recurse-submodules
pull_args --recurse-submodules
interval 3600
then hugo --source ./exampleSite --destination ../..