Skip to content

Instantly share code, notes, and snippets.

Avatar
🧐

Simon Eskildsen sirupsen

🧐
View GitHub Profile
anonymous
anonymous / what.rb
Created Aug 27, 2013
View what.rb
require 'yaml'
yaml = DATA.read
YAML::ENGINE.yamler = 'psych'
puts YAML.load(yaml)
YAML::ENGINE.yamler = 'syck'
puts YAML.load(yaml)
@dypsilon
dypsilon / frontendDevlopmentBookmarks.md
Last active Nov 15, 2022
A badass list of frontend development resources I collected over time.
View frontendDevlopmentBookmarks.md
@sirupsen
sirupsen / hosts.focus
Created Mar 13, 2013
My /etc/hosts and the accompanying crontab.
View hosts.focus
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
fe80::1%lo0 localhost
View turbo.cpp
#include<iostream>
#include<unistd.h>
#include<algorithm>
#include<map>
#include<vector>
#include<string>
#include<cassert>
#include<sstream>
#include<fstream>
using namespace std;
@funny-falcon
funny-falcon / changes.md
Last active May 27, 2021
Performace patch for ruby-1.9.3-p327
View changes.md

Changes:

  • this version includes backport of Greg Price's patch for speedup startup http://bugs.ruby-lang.org/issues/7158 .

    ruby-core prefers his way to do thing, so that I abandon cached-lp and sorted-lf patches of mine.

  • this version integrates 'array as queue' patch, which improves performance when push/shift pattern is heavily used on Array.

    This patch is accepted into trunk for Ruby 2.0 and last possible bug is found by Yui Naruse. It is used in production* for a couple of months without issues even with this bug.

@sirupsen
sirupsen / fast.cpp
Created Oct 18, 2012
Code for my competitive programming talk in C++ and Javascript. It solves the "Mega Inversion" problem from NCPC 2011: http://ncpc.idi.ntnu.no/ncpc2011/ncpc2011problems.pdf
View fast.cpp
#include<iostream>
#include<vector>
using namespace std;
typedef long long ll;
ll n;
vector<int> numbers;
struct Tree {
@mislav
mislav / easy_way.rb
Last active May 20, 2020
RESOLVE SHORT URLS before storing. Short URLs are for microblogging; you should never actually keep them around.
View easy_way.rb
require 'net/http'
# WARNING do not use this; it works but is very limited
def resolve url
res = Net::HTTP.get_response URI(url)
if res.code == '301' then res['location']
else url.to_s
end
end
@piscisaureus
piscisaureus / pr.md
Created Aug 13, 2012
Checkout github pull requests locally
View pr.md

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@mislav
mislav / gist:3313773
Created Aug 10, 2012
hosting one's own email
View gist:3313773

I want to get off Gmail for two reasons:

  1. my own *@mislav.net address
  2. to get my email under my own control so I can write scripts to process/analyze it

I've asked on Twitter what software should I use.
Here are the aggregated suggestions.

SMTP

@erikh
erikh / hack.sh
Created Mar 31, 2012 — forked from DAddYE/hack.sh
OSX For Hackers
View hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#