Skip to content

Instantly share code, notes, and snippets.

View ahmetb's full-sized avatar
🛑
Slow to respond

Ahmet Alp Balkan ahmetb

🛑
Slow to respond
View GitHub Profile
@ahmetb
ahmetb / Retry.cs
Last active August 29, 2015 13:57
Retry logic modified for our testing needs, see comments at the end
using System;
using System.Diagnostics;
using System.Threading.Tasks;
public class RetryLoop<TResult>
{
public RetryLoop(Func<RetryIterationContext<TResult>, Task<TResult>> func, Func<RetryIterationContext<TResult>, bool> succeeded)
{
this.func = func;
this.timer = new Stopwatch();
@tiborvass
tiborvass / main.go
Last active August 29, 2015 14:16
Hijacking Standard streams for Windows ANSI Emulation
package main
func Main() {
// everything that is currently in our main()
}
@tanaydin
tanaydin / LICENSE.txt
Created June 4, 2011 21:13 — forked from 140bytes/LICENSE.txt
140byt.es -- Click ↑↑ fork ↑↑ to play!
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
@nathanwdavis
nathanwdavis / partitioned_loops.go
Last active December 21, 2015 10:09
Messing around with really CPU intensive math ops and comparing simple for loops vs. goroutine per loop vs. partitioning into multiple goroutines (lightweight, green threads) in Go. The range partitioned goroutine-based solution tends to run around 3.5 - 4x faster than the simple for loop using 8 goroutines. The one that uses a goroutine per loo…
/*
Example Output:
➜ go run partitioned_loops.go
Starting...
simpleFor result: 468767562500, time: 0.013604745000000001 sec
goForEach result: 468767562500, time: 24.106190332 sec
goPartitioned result: 468767562500, time: 0.004296383 sec
*/
package main
@Kilian
Kilian / annoying.js
Created January 6, 2011 15:04
How to be an asshole
/**
* Annoying.js - How to be an asshole to your users
*
* DO NOT EVER, EVER USE THIS.
*
* Copyright (c) 2011 Kilian Valkhof (kilianvalkhof.com)
* Visit https://gist.github.com/767982 for more information and changelogs.
* Visit http://kilianvalkhof.com/2011/javascript/annoying-js-how-to-be-an-asshole/ for the introduction and weblog
* Check out https://gist.github.com/942745 if you want to annoy developer instead of visitors
*
@technoweenie
technoweenie / github_oauth_busy_developer_guide.md
Created May 30, 2010 18:34
GitHub OAuth Busy Developer's Guide

GitHub OAuth Busy Developer's Guide

This is a quick guide to OAuth2 support in GitHub for developers. This is still experimental and could change at any moment. This Gist will serve as a living document until it becomes finalized at Develop.GitHub.com.

OAuth2 is a protocol that lets external apps request authorization to private details in your GitHub account without getting your password. All developers need to register their application before getting started.

Web Application Flow

  • Redirect to this link to request GitHub access:
@ctechols
ctechols / compinit.zsh
Last active March 6, 2024 08:37
Speed up zsh compinit by only checking cache once a day.
# On slow systems, checking the cached .zcompdump file to see if it must be
# regenerated adds a noticable delay to zsh startup. This little hack restricts
# it to once a day. It should be pasted into your own completion file.
#
# The globbing is a little complicated here:
# - '#q' is an explicit glob qualifier that makes globbing work within zsh's [[ ]] construct.
# - 'N' makes the glob pattern evaluate to nothing when it doesn't match (rather than throw a globbing error)
# - '.' matches "regular files"
# - 'mh+24' matches files (or directories or whatever) that are older than 24 hours.
autoload -Uz compinit
@andreyvit
andreyvit / tmux.md
Created June 13, 2012 03:41
tmux cheatsheet

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

remap prefix to Control + a