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
#include <stdlib.h> | |
#include <sys/types.h> | |
#include <sys/socket.h> | |
#include <netdb.h> | |
#include <stdio.h> | |
#include <rpc/rpc.h> | |
#include <sys/time.h> | |
#include <string.h> | |
#include <arpa/inet.h> |
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
(defun cabo:nxml-balanced-close-start-tag-block () | |
"Close the start-tag before point with `>' and insert a balancing end-tag. | |
Point is left between the start-tag and the end-tag. | |
If there is nothing but whitespace before the `<' that opens the | |
start-tag, then put point on a blank line, and put the end-tag on | |
another line aligned with the start-tag." | |
(interactive "*") | |
(nxml-complete) | |
(nxml-balanced-close-start-tag-block)) |
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
(defun electric-pair-better-inhibit (char) | |
(or | |
(eq char (char-after)) | |
(and | |
(eq char (char-before (1- (point)))) | |
(let* ((syntax (electric-pair-syntax char))) | |
(not (eq syntax ?\()))) | |
(eq (char-syntax (following-char)) ?w))) |
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
float decode_half(int half) { | |
union { uint32_t u; float f; } val; | |
val.u = (half & 0x7fff) << 13 | (half & 0x8000) << 16; | |
if ((half & 0x7c00) != 0x7c00) | |
return val.f * 0x1p112; | |
val.u |= 0x7f800000; | |
return val.f; | |
} |
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 ruby | |
require 'mechanize' | |
URL = 'https://elearning.uni-bremen.de' | |
agent = Mechanize.new | |
page = agent.get(URL) | |
login_page = page.link_with(text: /for registered users/).click |
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
Let's see where we don't agree (this code doesn't do purge_nulls): | |
Mismatch: | |
orig: {"a":"foo","b":[3,null,{"x":null}]} | |
patch: {"b":[3,null,{"x":null}]} | |
draft: {"a":"foo","b":[3,{}]} | |
actual: {"a":"foo","b":[3,null,{"x":null}]} | |
Mismatch: | |
orig: [1,2] | |
patch: [1,null,3] | |
draft: [1,3] |
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
OPEN=$(word 1, $(wildcard /usr/bin/xdg-open /usr/bin/open /bin/echo)) |
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
(defconst elixir--cabo-prettify-symbols-alist | |
'( | |
("->" . ?➙) ; → ➜➽➤ | |
("::" . ?∷) | |
("<-" . ?⬅) ; ← | |
("<<" . ?⟪ ) ; «≪ | |
("=>" . ?⇒) | |
(">>" . ?⟫ ) ; »≫ | |
("do" . ?⫷) |
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
tell application "System Preferences" | |
activate | |
set the current pane to pane id "com.apple.preference.universalaccess" | |
tell application "System Events" | |
tell process "System Preferences" | |
tell window "Accessibility" | |
tell checkbox named "Use grayscale" | |
click | |
end tell | |
end tell |
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 ruby | |
MULT = { "" => 1, | |
"B" => 1, | |
"K" => 1024, | |
"M" => 1024*1024, | |
"G" => 1024*1024*1024, | |
"T" => 1024*1024*1024*1024, | |
} | |
def hrtonum(s) |