Skip to content

Instantly share code, notes, and snippets.

@rednaxelafx
rednaxelafx / DirectMemorySize.java
Created January 11, 2012 07:18
An Serviceability-Agent based tool to see stats of NIO direct memory, as an alternative on JDK6 without JMX support for direct memory monitoring. Only works on JDK6; to work on JDK7 will need some tweaking because static variables are moved to Java mirror
import java.io.*;
import java.util.*;
import sun.jvm.hotspot.memory.*;
import sun.jvm.hotspot.oops.*;
import sun.jvm.hotspot.debugger.*;
import sun.jvm.hotspot.runtime.*;
import sun.jvm.hotspot.tools.*;
import sun.jvm.hotspot.utilities.*;
public class DirectMemorySize extends Tool {
@seungwon0
seungwon0 / srt2txt.pl
Created February 4, 2012 15:19
Convert SRT into Text
#!/usr/bin/env perl
#
# srt2txt - Convert SRT into Text
#
# Seungwon Jeong <[email protected]>
#
# Copyright (C) 2012 by Seungwon Jeong
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@CristinaSolana
CristinaSolana / gist:1885435
Created February 22, 2012 14:56
Keeping a fork up to date

1. Clone your fork:

git clone [email protected]:YOUR-USERNAME/YOUR-FORKED-REPO.git

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://github.com/ORIGINAL-DEV-USERNAME/REPO-YOU-FORKED-FROM.git
git fetch upstream
@ddneat
ddneat / brew-gshuf
Last active October 9, 2020 09:01
listen to random music with afplay
brew install gshuf
#!/bin/bash
for f in $*; do
echo $f
emacs -batch "$f" -l ~/.emacs -l ~/local/bin/emacs-format-file -f emacs-format-function
done
@rubencaro
rubencaro / install_elixir.md
Last active September 30, 2023 03:58
Elixir installation guide

Elixir installation guide

Version numbers should be the ones you want. Here I do it with the last ones available at the moment of writing.

The simplest way to install elixir is using your package manager. Sadly, at the time of writing only Fedora shows the intention to keep its packages up to date. There you can simply sudo dnf install erlang elixir and you are good to go.

Anyway, if you intend to work with several versions of erlang or elixir at the same time, or you are tied to a specific version, you will need to compile it yourself. Then asdf is your best friend.

anonymous
anonymous / gist:f72e5c4a432492abce59
Created October 30, 2014 18:41
Arthur Whitney's interpreter, decompressed
typedef char C;
typedef long I;
typedef struct a {
I t,r,d[3],p[2];
}* A;
#define P printf
#!/bin/bash
# Usage: ./gen.sh collected-stacks.txt
TMPSTACKS=/tmp/flamegraph-stacks-collapsed.txt
TMPPALETTE=/tmp/flamegraph-palette.map
./stackcollapse-jstack.pl $1 > $TMPSTACKS
# 1st run - hot: default
@prakhar1989
prakhar1989 / richhickey.md
Last active November 8, 2023 17:19 — forked from stijlist/gist:bb932fb93e22fe6260b2
richhickey.md

Rich Hickey on becoming a better developer

Rich Hickey • 3 years ago

Sorry, I have to disagree with the entire premise here.

A wide variety of experiences might lead to well-roundedness, but not to greatness, nor even goodness. By constantly switching from one thing to another you are always reaching above your comfort zone, yes, but doing so by resetting your skill and knowledge level to zero.

Mastery comes from a combination of at least several of the following:

@heronlyj
heronlyj / SwiftChineseCharacter.swift
Last active October 6, 2016 03:14
Swift Separate Chinese Character
extension Character {
var scalrValue: UInt32 {
return String(self).unicodeScalars.first!.value
}
var isChineseCharacter: Bool {
switch self.scalrValue {
case 0x4E00...0x9FFF, 0x3400...0x4DBF, 0x20000...0x2A6DF, 0x2A700...0x2B73F: return true
default: return false