This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Source from the xnu kernel used in macOS | |
// source https://opensource.apple.com/source/xnu/xnu-3248.60.10/libsyscall/wrappers/mach_absolute_time.s | |
.globl _mach_absolute_time | |
_mach_absolute_time: | |
pushq %rbp // set up a frame for backtraces | |
movq %rsp,%rbp | |
movq $(_COMM_PAGE_TIME_DATA_START),%rsi | |
1: | |
movl _NT_GENERATION(%rsi),%r8d // get generation | |
testl %r8d,%r8d // if 0, data is being changed... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Control group /: | |
-.slice | |
├─624 /sbin/cgmanager -m name=systemd | |
├─machine.slice | |
│ └─machine-rkt\x2d6ff19b11\x2d0075\x2d48c6\x2d95e1\x2dc632da796d4e.scope | |
│ ├─init.scope | |
│ │ └─13469 /usr/lib/systemd/systemd --default-standard-output=tty --log-target=null --show-status=0 | |
│ └─system.slice | |
│ ├─nginx.service | |
│ │ ├─13490 nginx: master process /usr/sbin/nginx -g daemon off |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
snippet tt "table-driven tests" | |
func Test${1:Func}(t *testing.T) { | |
testCases := []struct { | |
${2:input} ${3:Type} | |
want ${4:Type} | |
}{ | |
{$2: ${5:""}, want: ${6:""}},${0: // comment} | |
} | |
for _, tc := range testCases { | |
if got := $1(tc.$2); got != tc.want { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package person_test | |
import ( | |
"fmt" | |
"strings" | |
) | |
// Person is a modern human with a name. | |
type Person struct { | |
name string |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"archive/zip" | |
"flag" | |
"log" | |
"net/http" | |
"golang.org/x/tools/godoc/vfs/httpfs" | |
"golang.org/x/tools/godoc/vfs/zipfs" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
import os, string | |
def random_password(length=14): | |
""" | |
Random password generator. | |
Default generated password will have an entropy of 84 bits. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST /api/authenticate | |
> Content-Type: application/x-www-form-urlencoded | |
> | |
user=lars,pass=secret | |
< 200 OK | |
< | |
{ | |
"token": "897ca80f3443de1ad9c0ce8f9d7c4449c68606e0" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | |
<plist version="1.0"> | |
<dict> | |
<key>icon-template</key> | |
<array> | |
<string>tmpl</string> | |
</array> | |
<key>icon-xml</key> | |
<array> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// service.js | |
angular.service('Address', function($resource, $cookies, $xhr, $log) { | |
// Add Header to comply with Django's CSRF implementation | |
token = $cookies['csrftoken']; | |
$xhr.defaults.headers['delete']['X-CSRFToken'] = token; | |
return $resource('/api/user/address/:addressId', {addressId:'@id'}, {}); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html xmlns:ng="http://angularjs.org"> | |
<meta charset="UTF-8" /> | |
<script src="http://code.angularjs.org/angular-0.9.19.min.js" ng:autobind></script> | |
<body> | |
<zippy class="open"> | |
<header>Greeting</header> | |
<pane>Hello World!</pane> | |
</zippy> |
NewerOlder