Skip to content

Instantly share code, notes, and snippets.

@fnordfish
fnordfish / Vagrantfile.pkg
Created October 26, 2010 16:18
A Vagrant system implementation for gentoo based linux
require File.expand_path("./gentoo.rb", File.dirname(__FILE__))
Vagrant::Config.run do |config|
config.vm.system = Gentoo
end
@snuggs
snuggs / .tmux.conf
Last active February 7, 2023 13:51
IDE & TMUX Configuration
############################################################################
# _
# | |_ _ __ ___ _ ___ __
# | __| '_ ` _ \| | | \ \/ /
# | |_| | | | | | |_| |> <
# \__|_| |_| |_|\__,_/_/\_\
#
# Cheatsheets:
# https://devhints.io/tmux
# `property not found` issue:
@jtriley
jtriley / terminalsize.py
Created July 26, 2011 21:58
Get current terminal size on Linux, Mac, and Windows
#!/usr/bin/env python
import os
import shlex
import struct
import platform
import subprocess
def get_terminal_size():
""" getTerminalSize()
@tetsuok
tetsuok / answer_pic.go
Created April 2, 2012 02:40
An answer of the exercise: Slices on a tour of Go
package main
import "code.google.com/p/go-tour/pic"
func Pic(dx, dy int) [][]uint8 {
// Allocate two-dimensioanl array.
a := make([][]uint8, dy)
for i := 0; i < dy; i++ {
a[i] = make([]uint8, dx)
}
@paulmillr
paulmillr / active.md
Last active June 21, 2024 13:48
Most active GitHub users (by contributions). http://twitter.com/paulmillr

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Wed, 21 Sep 2022 till Thu, 21 Sep 2023.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter(user =&gt; user.followers &gt; 1000)
@UniIsland
UniIsland / SimpleHTTPServerWithUpload.py
Created August 14, 2012 04:01
Simple Python Http Server with Upload
#!/usr/bin/env python
"""Simple HTTP Server With Upload.
This module builds on BaseHTTPServer by implementing the standard GET
and HEAD requests in a fairly straightforward manner.
"""
@codesaler
codesaler / 12factor.md
Created August 23, 2012 23:25 — forked from harmy/12factor.md
12factor

中文翻译:梁山 英文原文:Adam Wiggins

简介

如今,软件通常会作为一种服务来交付,它们被称为网络应用程序,或“软件即服务”(SaaS)。“十二要素应用程序”(12-Factor App)为构建如下的SaaS应用提供了方法论:

  • 使用标准化流程自动配置,从而使新的开发者花费最少的学习成本加入这个项目;
  • 和操作系统之间尽可能的划清界限,在各个系统中提供最大的可移植性
  • 适合部署在现代的云计算平台,从而在服务器和系统管理方面节省资源;
@svonava
svonava / selfspy to google docs
Created September 30, 2012 17:54
extract data from selfspy and append it as a row to google docs
import re
from datetime import timedelta
regex = re.compile(r'((?P<hours>\d+?)h)? ((?P<minutes>\d+?)m)? ((?P<seconds>\d+?)s)?')
regex2 = re.compile(r'((?P<minutes>\d+?)m)? ((?P<seconds>\d+?)s)?')
def parse_time(time_str):
parts = regex.match(time_str)
if not parts:
parts = regex2.match(time_str)
parts = parts.groupdict()
time_params = {}
@dcoles
dcoles / inline.py
Created November 14, 2012 09:13
Inline assembly in Python
import ctypes
import sys
import os
import errno
FUNC = ctypes.CFUNCTYPE(None)
PROT_NONE = 0
PROT_READ = 1
PROT_WRITE = 2
@sebpiq
sebpiq / gist:4128537
Last active April 22, 2024 15:20
Python implementation of the Goertzel algorithm for calculating DFT terms
# Copyright © 2020 Sébastien Piquemal sebpiq@protonmail.com
# This work is free. You can redistribute it and/or modify it under the
# terms of the Do What The Fuck You Want To Public License, Version 2,
# as published by Sam Hocevar. See the license text below for more details.
#
# --------------------------------------------------------------------
#
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#