Skip to content

Instantly share code, notes, and snippets.

@HatemMahmoud
HatemMahmoud / Ubuntu rbenv
Created September 7, 2011 12:56
Installing Ruby 1.9.2 with OpenSSL on Ubuntu 11.04 using ruby-build and rbenv
# for more info: https://gist.github.com/1120938
@lstoll
lstoll / JettyLauncher.scala
Created September 11, 2011 07:13
Scalatra on Heroku
/*
* Starts jetty for scalatra programatically
*
* Replace YourApplicationEndpointFilter with the filter in your application
*/
import org.eclipse.jetty.server.Server
import org.eclipse.jetty.servlet.{DefaultServlet, ServletContextHandler}
object JettyLauncher {
def main(args: Array[String]) {
@xuwei-k
xuwei-k / Main.scala
Created October 22, 2011 05:14
Scalaz Memo
package scalaz_memo_example
import scala.util.control.Exception.allCatch
import scalaz._
import Scalaz._
object Main{
def timer[T](f : => T):T = {
val start = System.currentTimeMillis
@aemkei
aemkei / LICENSE.txt
Last active June 4, 2024 07:51 — forked from 140bytes/LICENSE.txt
Binary Tetris - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@plusjade
plusjade / mathjax.rb
Created May 15, 2012 06:48
ruhoh plugin to overload the redcarpet parser with mathjax tags
# place mathjax.rb in _plugins directory of your blog
require 'redcarpet'
class HTMLwithAlbino < Redcarpet::Render::HTML
def block_code(code, language)
if language == 'mathjax'
"<script type=\"math/tex; mode=display\">
#{code}
</script>"
else
"<pre><code class=\"#{language}\">#{code}</code></pre>"
@datagrok
datagrok / README.md
Last active June 6, 2021 14:23
Circular imports in Python 2 and Python 3: when are they fatal? When do they work?
@KodrAus
KodrAus / Profile Rust on Linux.md
Last active November 14, 2023 17:19
Profiling Rust Applications

Profiling performance

Using perf:

$ perf record -g binary
$ perf script | stackcollapse-perf.pl | rust-unmangle | flamegraph.pl > flame.svg

NOTE: See @GabrielMajeri's comments below about the -g option.

@dlaehnemann
dlaehnemann / flamegraph_rust.md
Last active February 14, 2024 14:14
flamegraphing rust binaries' cpu usage with perf
@moyix
moyix / killbutmakeitlooklikeanaccident.sh
Created February 5, 2022 22:51
Script to inject an exit(0) syscall into a running process. NB: only x86_64 for now!
#!/bin/bash
gdb -p "$1" -batch -ex 'set {short}$rip = 0x050f' -ex 'set $rax=231' -ex 'set $rdi=0' -ex 'cont'