View singleton.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from typing import Any, Callable, ParamSpec, Type, TypeVar | |
T = TypeVar('T') | |
P = ParamSpec('P') | |
def singleton(cls: Type[T]) -> Callable[P, T]: | |
""" | |
Example: | |
>>> @singleton | |
... class C: ... |
View test.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
hello world |
View libcpuid.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Libcpuid < Formula | |
desc "A small C library for x86 CPU detection and feature extraction " | |
homepage "https://github.com/anrieff/libcpuid" | |
head "https://github.com/anrieff/libcpuid.git" | |
depends_on "automake" => :build | |
depends_on "libtool" => :build | |
depends_on "autoconf" => :build | |
def install |
View precmd.zsh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
autoload -U colors && colors | |
precmd() { | |
red_at="%{$fg[red]}@%{$reset_color%}" | |
red_dollar="%{$fg[red]%}$%{$reset_color%}" | |
typeset host_info | |
[[ -n $SSH_CONNECTION ]] && host_info="$USER${red_at}$HOST " | |
if [[ $USER == "CC" ]]; then | |
# number of chracters of the path of the prompt is less 30 | |
# use '~' to represent $HOME as long as possible |
View gdb.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class UniversalBrewedPython < Requirement | |
satisfy { archs_for_command("python").universal? } | |
def message; <<-EOS.undent | |
A build of GDB using a brewed Python was requested, but Python is not | |
a universal build. | |
GDB requires Python to be built as a universal binary or it will fail | |
if attempting to debug a 32-bit binary on a 64-bit host. | |
EOS |
View latexmk.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Latexmk < Formula | |
desc "Latexmk completely automates the process of generating a LaTeX document." | |
homepage "http://users.phys.psu.edu/~collins/software/latexmk-jcc/" | |
url "http://users.phys.psu.edu/%7Ecollins/software/latexmk-jcc/latexmk-443a.zip" | |
sha256 "e410d295c0a47327b953ece5b582c294359bdf89138ef990d5621b020ff2bbe5" | |
depends_on :tex | |
depends_on "ghostscript" => :optional | |
def install |
View zlog.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Zlog < Formula | |
homepage "https://hardysimpson.github.io/zlog/" | |
stable do | |
url "https://github.com/HardySimpson/zlog/archive/1.2.12.tar.gz" | |
sha1 "592be9688df1a713e190e2a9664157516cc6724f" | |
end | |
head do | |
url "https://github.com/HardySimpson/zlog.git" |
View r2.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require "formula" | |
class R2 < Formula | |
homepage "http://radare.org" | |
revision 2 | |
head do | |
url "https://github.com/radare/radare2.git" | |
resource "bindings" do |
View debian-patches-05_fix_off_by_one.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -urNad nbtscan-1.5.1~/nbtscan.c nbtscan-1.5.1/nbtscan.c | |
--- nbtscan-1.5.1~/nbtscan.c 2003-06-06 14:14:00.000000000 +0200 | |
+++ nbtscan-1.5.1/nbtscan.c 2008-05-09 14:38:59.000000000 +0200 | |
@@ -111,7 +111,7 @@ | |
for(i=0; i< hostinfo->header->number_of_names; i++) { | |
service = hostinfo->names[i].ascii_name[15]; | |
strncpy(name, hostinfo->names[i].ascii_name, 15); | |
- name[16]=0; | |
+ name[15]=0; | |
printf("%-17s Service: 0x%02x Flags: 0x%04x\n", name, service, hostinfo->names[i].rr_flags); |
View debian-patches-04_fix_compiler_warnings.diff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff -urNad nbtscan-1.5.1~/list.c nbtscan-1.5.1/list.c | |
--- nbtscan-1.5.1~/list.c 2008-05-08 14:10:54.000000000 +0200 | |
+++ nbtscan-1.5.1/list.c 2008-05-08 14:12:29.000000000 +0200 | |
@@ -49,7 +49,7 @@ | |
if(item1==NULL) return 1; | |
if(item1->content == item2->content) return 0; | |
if(item1->content > item2->content) return 1; | |
- if(item1->content < item2->content) return -1; | |
+ return -1; | |
}; |
NewerOlder