Top emacs lisp Geeks


Check out snippets of the blog postings. Click on the link to view the full post at the original site as the author intended.

nagachika

[ruby][changes]ruby-trunk-changes r54554 - r54564

nagachika  on  4/12/2016

今日は開発者会議効果か、多値の代入を条件部に書けるようにする文法の変更や、Integer#floor, #ceil, Float#floor, #ceil が省略可能な引数で操作する桁を指定できるようにする拡張、File.empty? の追加などの新機能が多くありました。 nobu: r54554 2016-04-13 11:41:24 +

ruby changes 
nagachika

[ruby][changes]ruby-trunk-changes r54554 - r54564

nagachika  on  4/12/2016

今日は開発者会議効果か、多値の代入を条件部に書けるようにする文法の変更や、Integer#floor, #ceil, Float#floor, #ceil が省略可能な引数で操作する桁を指定できるようにする拡張、File.empty? の追加などの新機能が多くありました。 nobu: r54554 2016-04-13 11:41:24 +

ruby changes 
nagachika

[ruby][changes]ruby-trunk-changes r54546 - r54553

nagachika  on  4/11/2016

今日は拡張ライブラリ date の Time#to_time がタイムゾーンをコピーするようにする変更がありました。 nobu: r54546 2016-04-12 09:30:55 +0900 VM の命令列の末尾呼び出し最適化についてのテストで失敗時のメッセージに対象のメソッドの VM 命令列を disasm したものを表

ruby changes 
nagachika

[ruby][changes]ruby-trunk-changes r54546 - r54553

nagachika  on  4/11/2016

今日は拡張ライブラリ date の Time#to_time がタイムゾーンをコピーするようにする変更がありました。 nobu: r54546 2016-04-12 09:30:55 +0900 VM の命令列の末尾呼び出し最適化についてのテストで失敗時のメッセージに対象のメソッドの VM 命令列を disasm したものを表

ruby changes 
nagachika

[ruby][changes]ruby-trunk-changes r54530 - r54545

nagachika  on  4/10/2016

今日は末尾呼び出し最適化の不具合修正の他、主にテストの警告除去などがありました。 nobu: r54530 2016-04-11 06:54:41 +0900 file.c の apply2files() という関数で処理対象の引数を Ruby の Array オブジェクトで渡すのをやめて argc/argv で渡すように変更し、呼び元で

ruby changes 
nagachika

[ruby][changes]ruby-trunk-changes r54530 - r54545

nagachika  on  4/10/2016

今日は末尾呼び出し最適化の不具合修正の他、主にテストの警告除去などがありました。 nobu: r54530 2016-04-11 06:54:41 +0900 file.c の apply2files() という関数で処理対象の引数を Ruby の Array オブジェクトで渡すのをやめて argc/argv で渡すように変更し、呼び元で

ruby changes 
skeeto

Mapping Multiple Memory Views in User Space

skeeto  on  4/10/2016

Modern operating systems run processes within virtual memory using a piece of hardware called a memory management unit (MMU). The MMU contains a page table that defines how virtual memory maps onto physical memory. The operating system is responsible for maintaining this page table, mapping and unmapping virtual memory to physical memory as needed by the processes it’s running. If a process accesses a page that is not currently mapped, it will trigger a page fault and the execution of the offending thread will be paused until the operating system maps that page.

This functionality allows for a neat hack: A physical memory address can be mapped to multiple virtual memory addresses at the same time. A process running with such a mapping will

[...]

nagachika

[ruby][changes]ruby-trunk-changes r54526 - r54529

nagachika  on  4/9/2016

今日は win32/registry の不具合修正などがありました。 nobu: r54526 2016-04-10 16:30:42 +0900 win32/file.c の rb_file_expand_path_internal() でメモリ解放時に xfree() を使っていましたが、対応するバッファの確保は malloc() で行なわれていたので free() を使うよ

ruby changes 
nagachika

[ruby][changes]ruby-trunk-changes r54526 - r54529

nagachika  on  4/9/2016

今日は win32/registry の不具合修正などがありました。 nobu: r54526 2016-04-10 16:30:42 +0900 win32/file.c の rb_file_expand_path_internal() でメモリ解放時に xfree() を使っていましたが、対応するバッファの確保は malloc() で行なわれていたので free() を使うよ

ruby changes 
kidd

My mail signatures: 2006 - 2016

kidd  on  4/8/2016

2006

--
Vi is clearly superior to emacs, since "vi" has only two characters
(and two keystrokes), while "emacs" has five.  (Randy C. Ford)

2016

--
"Emacs saves you time when you work, and takes it back when you play with it"

emacs vim 
kjhealy

Tironian Notes

kjhealy  on  4/8/2016

Irish parking sign with a Tironian ⁊, or et.

Irish parking sign with a Tironian ⁊, or et.

If you visit Ireland, you’ll see that official signs (such as road signs and the like) are written in both English and Irish. On some of them you’ll see a character that looks like a backwards ‘r’, like this: ⁊. It’s used instead of an ampersand, or &. Although I knew the glyph and its meaning (it’s common enough on signage, and some of my teachers used it when they wrote on the board), until yesterday I never knew why it looked like that. I learned yesterday from a friend that the symbol has its origins in the Tironian Notes, a Roman system of shorthand

[...]

kidd

TIL: 2 extra comment-dwim features

kidd  on  4/2/2016

Today I just learned (by accident) a couple of tricks related to`comment-dwim'. The emacs command is bound to M-; , and it has different behaviours  depending on the line, region, and contents of the selection.

Appart from the ovbious behaviour we all know, today I found that:

  • Called with universal argument in an empty line, it adds ARG comment markers in the line. try C-u M-; in an empty line.
  • In a line with comments, c-u m-; removes the comments. that means deleting the comment, NOT UNCOMMENTING but removing all commentted text and the comment marker itself.

emacs TodayILearnt 
kidd

definitely not planar

kidd  on  4/1/2016

Once in a while, you find something enlightening, that changes your perspective. One of them is geometric progressions. How they grow so fast, and how dense graphs (k-graphs) deal with this kind of progressions al the time. But I digress...

Irreal (a very active blogger in the emacs scene) has been posting about a series of posts from John Kitchin, about Hy. All this referred by Karl Voit.  It's kinda funny when for a given John's post, there is an Irreal's counterpart, that links to John's, and probably to older Irreal's posts of the same topic.  This reminds me somehow of classes pointing to superclasses and metaclasses (In smalltalk). 

Here's how I imagine it.


Also, let me add myself to the chain, and also mention that [...]

general programming mis cosas smalltalk 
skeeto

Hotpatching a C Function on x86

skeeto  on  3/31/2016

In this post I’m going to do a silly, but interesting, exercise that should never be done in any program that actually matters. I’m going write a program that changes one of its function definitions while it’s actively running and using that function. Unlike last time, this won’t involve shared libraries, but it will require x86_64 and GCC. Most of the time it will work with Clang, too, but it’s missing an important compiler option that makes it stable.

If you want to see it all up front, here’s the full source: hotpatch.c

Here’s the function that I’m going to change:

void
hello(void)
{
    puts("hello");
}

It’s dead simple, but that’s just for demonstration purposes. This will work with any function of arbitrary complexity. The

[...]

ripienaar

A Puppet 4 Hiera Based Node Classifier

ripienaar  on  3/22/2016

When I first wrote Hiera I included a simple little hack called hiera_include() that would do a Array lookup and include everything it found. I only included it even because include at the time did not take Array arguments. In time this has become quite widely used and many people do their node classification using Read More

Code devops puppet 
kidd

console tools for structured trext

kidd  on  3/20/2016

The lingua franca of unix is plain text and raw files. That's why we can do so many things using its standard tools and pipes as combinators.

But there are some special formats of files which have a concrete structure, and we can extract meaning from its structure. For example CSV.

JQ

jq is like sed for json files. It allows you to parse, grep, replace, match and join json files. For example, /tmp/issues.json being the output of a github repo issues:

cat /tmp/issues.json | jq '.[] |select(.labels[].name | in({"S-zendesk": 12})) | {labels: [.labels[].name | match("^A-.*") | .string] }'

Select issues which have label S-zendesk, and pick the label A-* of it. To know which are the areas that have zendesk issues.

Xmlstarlet

Xmlstarlet is the same as jq [...]

linux 
kidd

Praising MJD

kidd  on  3/20/2016

Mark Jason Dominus is one of those guys that is worth following everywhere in the net.

  • Web: His site is quite old school. It reminds me of c2, or norvig.com, that have really old look but is full of insights and no-bullshit content. Also, loads instantly.
  • Blog: Wide range of topics. From systems programming to functional programming, haskell, monads, git, books, alien codes, mathematics.... 
  • Book: Higher Order Perl is a great book on functional programming. It uses Perl, but the concepts are really language agnostic. It clearly follows a similar approach to SICP, maybe with a more practical approach.  Higher Order Perl is on my top 10 list of tech books. Top5 if we exclude lisp books.
  • Talks: He excels at giving talks also. There are
[...]

general programming perl 
kidd

programming quizzes with org-babel

kidd  on  3/18/2016

When trying to write some proof of concept, or an algorithm in isolation (or programming quizes), I usually create a new file (foo.lua, for example), and run it with my patched version of shell-execute that replaces '%' by the current file name .

But sometimes I want to give more context or write the code as a story, or a question-answer dialogue.  In those occasions, org-babel is the way to go.
This piece of elisp enables a bunch of languages to be evaluated in org file blocks:

(org-babel-do-load-languages
'org-babel-load-languages
'((ditaa . t)
(tcl . t)
(ruby . t)
(sqlite . t)
(clojure . t)
(lisp . t)
(http . t)
(sql . t)))


Now, in the org file itself, place this kind of block:
#+BEGIN_SRC sqlite :db pieces-and-providers.
[...]

emacs 
ripienaar

Puppet 4 Type Aliases

ripienaar  on  3/18/2016

Back when I first took a look at Puppet 4 features I explored the new Data Types and said: Additionally I cannot see myself using a Struct like above in the argument list – to which Henrik says they are looking to add a typedef thing to the language so you can give complex Struc’s Read More

Code devops puppet 
ripienaar

The Puppet 4 Lookup Function

ripienaar  on  3/13/2016

Puppet 4 has a new lookup subsystem exposed to the user in a few places: The lookup() function Automatic parameter lookups Configuring the automatic parameter lookups via Data in Modules I’ve not been able to figure out everything the docs have been trying to say about this function but it turns out they were copied Read More

Code devops puppet 
dansimau

Photo

dansimau  on  3/11/2016



dansimau

Photo

dansimau  on  3/11/2016



dansimau

Photo

dansimau  on  3/11/2016



dansimau

"A friend is someone who knows the song in your heart, and can sing it back to you when you have..."

dansimau  on  3/11/2016

“A friend is someone who knows the song in your heart, and can sing it back to you when you have forgotten the words.”

- (via dansimau)

dansimau

Photo

dansimau  on  3/11/2016



kjhealy

The Protracted Game

kjhealy  on  3/10/2016

You may have heard the news that Lee Sedol, a Go Master, has been defeated by a computer program created by a group of Google engineers. A second match is underway today. The Google/DeepMind team has a technical paper in Nature describing AlphaGo, the program they wrote. Various commentators have remarked on the sometimes surprising but extremely effective moves that AlphaGo made. And of course there’s the usual half-serious musings about the inevitable robot uprising that this victory portends.

On the way to work on the bus this morning I was listening to a podcast where the hosts expressed some relief that being able to make a computer that is really, really good at Go is at least still a very long way off from accidentally

[...]

kjhealy

Plain Text and Pictures

kjhealy  on  3/9/2016

Here are two small sites I made recently, and which I may continue to tweak and expand. The first, plain-text.co, presents “The Plain Person’s Guide to Plain-Text Social Science”. It is designed to address some questions about managing research and writing projects in the social sciences using plain-text and free or mostly-free tools like Emacs (or other text editors), R, pandoc, and make. The second, vissoc.co which I’ve mentioned before, compiles notes from a short course in data visualization I taught last semester. In both cases, the source files behind the sites are available on github, along with various templates, examples, and configuration files (more about those here) meant to make your plain-text coding

[...]

pjstadig

Making Fake Things

pjstadig  on  3/7/2016

Software is fake. There are bits inside a computer represented by a magnetic or electrical charge or mechanical potential or some such thing. But software is not an electrical charge. Electrical charges can represent ones and zeroes and a series of ones and zeroes like "10111101" can represent the JVM opcode "anewarray" or the fraction one-half ("½") in the ISO-8859-1 character encoding or the number -67 in twos-complement. Software is not electrical charges, it is a particular interpretation imposed on electrical charges. An interpretation does not weigh anything. It has no color, taste, temperature, volume, mass, or any physical features. It is fake, but fake things can be useful.

Fake things can represent real things (or other [...]

pjstadig

Making Fake Things

pjstadig  on  3/7/2016

Software is fake. There are bits inside a computer represented by a magnetic or electrical charge or mechanical potential or some such thing. But software is not an electrical charge. Electrical charges can represent ones and zeroes and a series of ones and zeroes like "10111101" can represent the JVM opcode "anewarray" or the fraction one-half ("½") in the ISO-8859-1 character encoding or the number -67 in twos-complement. Software is not electrical charges, it is a particular interpretation imposed on electrical charges. An interpretation does not weigh anything. It has no color, taste, temperature, volume, mass, or any physical features. It is fake, but fake things can be useful.

Fake things can represent real things (or other [...]

ripienaar

params.pp in Puppet 4

ripienaar  on  3/6/2016

I do not like the params.pp pattern. Puppet 4 has brought native Data in Modules that’s pretty awesome and to a large extend it removes the traditional need for params.pp. Thing is, we kind of do still need some parts of params.pp. To understand this we have to consider what the areas of concern params.pp Read More

Code devops puppet 
dansimau

Photo

dansimau  on  3/6/2016













dansimau

Photo

dansimau  on  3/6/2016



skeeto

Calling the Native API While Freestanding

skeeto  on  2/28/2016

When developing minimal, freestanding Windows programs, it’s obviously beneficial to take full advantage of dynamic libraries that are already linked rather than duplicate that functionality in the application itself. Every Windows process automatically, and involuntarily, has kernel32.dll and ntdll.dll loaded into its process space before it starts. As discussed previously, kernel32.dll provides the Windows API (Win32). The other, ntdll.dll, provides the Native API for user space applications, and is the focus of this article.

The Native API is a low-level API, a foundation for the implementation of the Windows API and various components that don’t use the Windows API (drivers, etc.). It includes a runtime library (RTL) suitable for

[...]

ripienaar

The Resource Wrapper Pattern in Puppet 4

ripienaar  on  2/28/2016

One tends to need to wrap resources quite often in Puppet and prior to Puppet 4 this was extremely annoying and resulted in a high maintenance burden, but in Puppet 4 this has significantly improved so I thought I’ll write a quick post about that. Why wrap resources? The example I’ll show here is going Read More

Code devops puppet 
dansimau

Photo

dansimau  on  2/28/2016



dansimau

Photo

dansimau  on  2/25/2016



dansimau

Photo

dansimau  on  2/25/2016



kjhealy

The Plain Person's Guide to Plain Text Social Science

kjhealy  on  2/23/2016

As a beginning graduate student in the social sciences, what sort of software should you use to do your work? More importantly, what principles should guide your choices? This article offers some answers. The short version is: you should use tools that give you more control over the process of data analysis and writing. I recommend you write prose and code using a good text editor; analyze quantitative data with R or Stata; minimize error by storing your work in a simple format (plain text is best), and make a habit of documenting what you’ve done. For data analysis, consider using a format like Rmarkdown and tools like Knitr to make your work more easily reproducible for your future self. Use Pandoc to turn your plain-text documents

[...]

kjhealy

Walled Garden

kjhealy  on  2/18/2016

The FBI obtained a court order requiring Apple to unlock an iPhone 5C belonging to the San Bernardino killer. A public letter from Tim Cook lays out the grounds for Apple’s refusal. The debate about this conflict is developing quickly on both the technical side of things and the public policy side.

As a sidelight to this debate, I want to ask why is it that Apple, of all companies, is the one taking such a strong stand on this issue? It’s clear that Apple wants to resist the court order because of the precedent it would set—essentially requiring firms to break the security on their own products when investigators demand it. But that doesn’t answer my question. Why is Apple, specifically, fighting so hard on this?

[...]

kjhealy

Two Revolutions

kjhealy  on  2/15/2016

In the next week or two I’ll be talking to some social science students about tools for doing research and writing up results. Over the years I’ve accumulated various things on the topic, ranging from bits of advice to templates or things I use myself. My focus is on managing the various pieces of the work process in plain-text, especially when it comes to writing code you can read later, and keeping track of the work you’ve done. When talking to undergraduates or graduate students about this, and when teaching classes that use these tools, I increasingly run into the problem that it’s hard to get started on this topic without backing up a bit first in order to talk about how the computer they are using works.

I

[...]

kjhealy

Gravitational Network

kjhealy  on  2/12/2016

The Gravitational Waves paper that was in the news yesterday has almost a thousand authors. (Actually there’s more than one paper—there’s the “discovery” paper and the “implications” paper.) Out of interest, I fed the list of authors in the “implications” paper into R and constructed an affiliation network with ties based on the university or research institute listed. Then I colored the nodes by the country of the primary institutional affiliation. Some authors have up to three affiliations, and they act as bridges in the network of authors. The national structure comes out nicely, too, with a core network consisting of American, Italian, and German scientists, with the British and

[...]

kidd

Test spies with Lua metatables

kidd  on  2/11/2016

Dabbling with Lua metatables, I tried to write a minimal testing library that does not impose you any funny 'describe(...)' or 'it(....)' nesting, and one can just organise the tests as he pleases.

What

I called it spacesuit.lua as it wraps your functions and gives you minimal support to write tests (assertions and spies) in the wild. If you need your tests to be TAP compliant, runnable from any platform, and a well known solution, I can recommend busted, but for me, I tried to keep it minimal so I can put it in my bag and run the files I need from my console, using some silly bash/zsh script using globbing. no need for luarocks, native compilation of lfs or anything.

Apart from providing some sugar for assert_equal (which I'll probably delete [...]

general programming lua 
kidd

With this trick, Helm-dash gets find-as-you-type for free, developers hate it...

kidd  on  2/11/2016

It's been a long time since I had this feature in mind. Where helm-dash would open documentation pages as you typed. 

It is clearly possible to run actions while pressing keys (helm-swoop does it). But when I looked at its code, I saw the author had rewritten and rebound most of the keys to add the 'hooks'. I clearly didn't want to do that.  

So I kept looking for cleaner solutions (helm-dash didn't have to do complex things, just trigger the action at every keypress), and wrote my finding in this issue. hooking to helm-idle, or hooking to 'helm-after-update-hook seemed the sanest options, but none was compelling enough.

Then I learned that you can set a 'persistent-action', that will run when you press c-z and won't quit helm. Ok,
[...]

emacs 
kjhealy

Data Visualization Course Notes

kjhealy  on  2/10/2016

ASA Section Memberships.

ASA Section Membership and Revenues.

I taught a half-sized introductory seminar on data visualization last semester. It’s an introduction to some principles of data visualization for working social scientists, and is focused mostly on teaching people how to use ggplot effectively. I’ve made the (slightly rough-and-ready) course notes available as a website. The notes include numerous code samples, .Rmd files for every week, and there’s a GitHub repository containing all the material to build the site, including the datasets used to make the plots. Enjoy.

[...]

kjhealy

A Kind of Magic

kjhealy  on  2/6/2016

This week’s ATP episode covers the tide of complaints about Apple’s software quality problem. There’s some good sputtering from John. The gist is that niggling software problems have become much more pervasive, even as dramatic events like full-on application crashes are rarer. An important secondary point is that, partly as a consequence of the ubiquity of cloud services and partly as a result of Apple’s choices in software design, when these errors happen they often present themselves to the user in an especially opaque way. For example, poorly implemented cloud services result in weird and inconsistent patterns of events centered on syncing. Then, the Ivean determination to make applications as “pure”,

[...]

ripienaar

Puppet 4 data lookup strategies

ripienaar  on  2/3/2016

I recently wrote about the new Data in Modules support in Puppet 4, there’s another new feature that goes hand in hand with this to finally rid us of functions like hiera_hash() and such. Up to now we’ve had to do something ugly like this to handle merged class parameters: class users($local = hiera_hash("users::local", {}) Read More

Code devops puppet 
skeeto

Small, Freestanding Windows Executables

skeeto  on  1/31/2016

Recently I’ve been experimenting with freestanding C programs on Windows. Freestanding refers to programs that don’t link, either statically or dynamically, against a standard library (i.e. libc). This is typical for operating systems and similar, bare metal situations. Normally a C compiler can make assumptions about the semantics of functions provided by the C standard library. For example, the compiler will likely replace a call to a small, fixed-size memmove() with move instructions. Since a freestanding program would supply its own, it may have different semantics.

My usual go to for C/C++ on Windows is Mingw-w64, which has greatly suited my needs the past couple of years. It’s packaged on Debian, and, when combined with Wine, allows

[...]

kidd

Let's talk about multiplicative factors

kidd  on  1/27/2016

It seems 2016 came with some buzz on a couple of recurrent topics: 'Unicorns do/do-not exist', 'github rules/sucks' and 'the 10x programmer'.

I'm not sure about the first statement, and I'm by no means qualified to talk about it. But on the 2nd one, because I'm always looking for reasons and ways to improve, and because I like the "worse is better" (tacking this into account) debate. So here are some of them:

It's funny how in the 2nd link, there's this point:

Let’s not adopt this new technology.
Can we achieve the same thing with [...]

general programming mis cosas 
kidd

Pointy org-bullets

kidd  on  1/26/2016

As it seems everyone in my internet neighborhood is publishing their org-bullet configs, that's how my bullets in org look like now.

 It's quite intuitive: the more pointed, the more important. And there are no differences in the line height.

Here's a screenshot:


;; http://nadeausoftware.com/articles/2007/11/latency_friendly_customized_bullets_using_unicode_characters
(eval-after-load 'org-bullets
  '(setq org-bullets-bullet-list '("✺" "✹" "✸" "✷" "✶" "✭" "✦" "■" "▲" "●" )))

[...]

emacs 
kidd

Difference lists recap

kidd  on  1/18/2016

In CTM, around page 145, the authors talk about a list implementation called Difference Lists. At the abstract level, a dlist is just a list. an ordered list, that has constant time for pushing elements on the front, and a way to iterate over its elements, one by one. It's made of Conses, and the last cdr points to nil.

The difference with normal lists is that it provides -- thanks to the way how Oz (and prolog) can unify unbound variables -- a way to append 2 lists in constant time. The same principle, when applied can lead to very efficient implementations of operations like flatten or reverse, and this leads to efficient ways to code other datastructures like Queues.

I could try to explain how they work, and how you can achieve this [...]

declarative programming general programming