Skip to content

Instantly share code, notes, and snippets.

@kavu
kavu / example.go
Created September 28, 2013 10:01
Minimal Golang + Cocoa application using CGO. Build with `CC=clang go build`
package main
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
int
StartApp(void) {
[NSAutoreleasePool new];
pragma solidity 0.5.5;
contract TxPermission {
/// Allowed transaction types mask
uint32 constant None = 0;
uint32 constant All = 0xffffffff;
uint32 constant Basic = 0x01;
uint32 constant Call = 0x02;
uint32 constant Create = 0x04;
uint32 constant Private = 0x08;
@kavu
kavu / wishlist.txt
Last active July 1, 2020 07:41
My DIM Wishlist
dimwishlist:item=614426548&perks=2827049491,269888150,2030760728,3913600130
dimwishlist:item=614426548&perks=2827049491,269888150,1749209109,3913600130
dimwishlist:item=614426548&perks=3666208348,269888150,1749209109,3913600130
dimwishlist:item=614426548&perks=938542991,269888150,1749209109,3913600130
dimwishlist:item=614426548&perks=2827049491,269888150,2590710093,3913600130
dimwishlist:item=614426548&perks=3666208348,269888150,2590710093,3913600130
dimwishlist:item=614426548&perks=938542991,269888150,2590710093,3913600130
@kavu
kavu / gist:1023207
Created June 13, 2011 17:13
Net::HTTP::Patch
require 'net/http'
require 'json'
class Net::HTTP::Patch < Net::HTTPRequest
METHOD = 'PATCH'
REQUEST_HAS_BODY = true
RESPONSE_HAS_BODY = true
end
url = URI.parse('https://api.github.com/user')
// ПоПацански.cpp : Defines the entry point for the console application.
//
// #include "stdafx.h"
#define подъёбку setlocale
#define чуть_чуть 7
#define так_себе 12
#define пошло_оно_всё 120
@kavu
kavu / grep-it.sh
Last active August 9, 2018 14:52
All Parity logging targets
#!/bin/sh
grep -Roh --exclude-dir=target 'target: "[^"]*",' parity | sed -n 's/target: \("[^"]*"\),/\1/p' | sed -n 's/"//pg' | sort | uniq
@kavu
kavu / Gemfile
Last active July 17, 2017 05:38 — forked from anonymous/Gemfile
How to make Rails + Backup + Whenever + Capistrano (and rbenv) work.
#...
gem 'backup', require: false,
github: 'kavu/backup',
branch: 'bump_fog_version',
ref: 'c3fd8e6eb4f464de1c8'
gem 'whenever', require: false
#...
@kavu
kavu / swift.sh
Last active June 20, 2017 02:58
Minimal Swift command line Hello World
#!/bin/sh
# So you've installed XCode 6 Beta
# Now we could use Swift toolchain to build a minimal
# command line Hellow World
# let's set new Developer Toolchain bundled with Xcode6-Beta.app
# as default toolchain
# sudo xcode-select -s /Applications/Xcode6-Beta.app/Contents/Developer
# alias for Swift binary
@kavu
kavu / Makefile
Created August 19, 2016 19:24
Nice Go Makefile
VERSION := $(shell git describe --tags | sed -e 's/^v//g' | awk -F "-" '{print $$1}')
ITERATION := $(shell git describe --tags --long | awk -F "-" '{print $$2}')
GO_VERSION=$(shell gobuild -v)
GO := $(or $(GOROOT),/usr/lib/go)/bin/go
PROCS := $(shell nproc)
cores:
@echo "cores: $(PROCS)"
test:
go test -v
bench:
func IsInSlice(slice []int, searching int) bool {
intSlice := make(sort.IntSlice, len(slice))
copy(intSlice, slice)
sort.Sort(intSlice)
return sort.SearchInts(intSlice, searching) < len(slice)
}