Skip to content

Instantly share code, notes, and snippets.

View wangyandongnx's full-sized avatar

Wang Yandong wangyandongnx

View GitHub Profile
@torsten
torsten / proxy.rb
Last active April 30, 2024 17:53
A quick HTTP proxy server in Ruby.
#!/usr/bin/env ruby
# A quick and dirty implementation of an HTTP proxy server in Ruby
# because I did not want to install anything.
#
# Copyright (C) 2009-2014 Torsten Becker <[email protected]>
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
@banksean
banksean / mersenne-twister.js
Created February 10, 2010 16:24
a Mersenne Twister implementation in javascript. Makes up for Math.random() not letting you specify a seed value.
/*
I've wrapped Makoto Matsumoto and Takuji Nishimura's code in a namespace
so it's better encapsulated. Now you can have multiple random number generators
and they won't stomp all over eachother's state.
If you want to use this as a substitute for Math.random(), use the random()
method like so:
var m = new MersenneTwister();
@zwaldowski
zwaldowski / MASWindow.h
Created January 28, 2011 21:15
A Mac App Store-like NSWindow subclass.
//
// MASWindow.h
// A Mac App Store-like NSWindow subclass.
//
// Created by Zachary Waldowski on 1/8/11.
// Secured under the "do-whatever-the-hell-you-want-with-it" license. Erm, copyright 2011.
//
#import <Cocoa/Cocoa.h>
@netmute
netmute / init.vim
Last active October 17, 2019 11:20
init.vim
" PLEASE NOTE: I'm assuming nvim defaults in this configuration.
" Regular vimmers might need to tweak here and there.
" Add autogenerated tags file to the lookup path.
set tags+=.git/tags
" Add fzf plugin.
set rtp+=/usr/local/opt/fzf
" Use a source for FZF that respects '.gitignore'.
@IanVaughan
IanVaughan / uninstall_gems.sh
Created June 9, 2012 20:37
Uninstall all rbenv gems
#!/usr/bin/env bash
uninstall() {
list=`gem list --no-versions`
for gem in $list; do
gem uninstall $gem -aIx
done
gem list
gem install bundler
}
@return1
return1 / bitcoin-cpuminer.sh
Last active July 8, 2024 19:21
install a bitcoin cpuminer on ubuntu/debian
# install dependencies
sudo apt-get install libcurl4-openssl-dev libncurses5-dev pkg-config automake yasm
# clone cpuminer
git clone https://github.com/pooler/cpuminer.git
# compile
cd cpuminer
./autogen.sh
./configure CFLAGS="-O3"
@premist
premist / cgminer.rb
Last active August 13, 2021 01:29
Install cgminer on Mac OS X using homebrew
require 'formula'
# Original : https://raw.github.com/Kaelten/homebrew/master/Library/Formula/cgminer.rb
class Cgminer < Formula
homepage 'https://github.com/ckolivas/cgminer'
url 'https://github.com/ckolivas/cgminer/archive/v2.10.4.zip'
sha1 'cf592852b913749378db7f43a561b90c2b6448be'
depends_on 'automake' => :build
@fabiofl
fabiofl / gist:5873100
Created June 27, 2013 00:41
Clear Mac OS X's icon cache.
sudo find /private/var/folders/ -name com.apple.dock.iconcache -exec rm {} \;
@nyergler
nyergler / kenobi.el
Created July 28, 2013 20:31
Personal Emacs configuration for detecting virtual environments, adding egg directories, and allowing extra paths to be added to the Jedi auto-completion server.
(add-hook 'hack-local-variables-hook 'run-local-vars-mode-hook)
(defun run-local-vars-mode-hook ()
"Run a hook for the major-mode after the local variables have been processed."
(run-hooks (intern (concat (symbol-name major-mode) "-local-vars-hook"))))
(defun detect_buffer_venv (buffer-name)
(let ((buffer-dir (file-name-directory buffer-name)))
/*
* TGDFileHash.c
* TagAdA: Tagging Advanced Application
*
* Copyright © 2008-2010 The TagAdA Team. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*