Skip to content

Instantly share code, notes, and snippets.

@jonyesno
jonyesno / ddar-bsd.patch
Created April 28, 2011 08:13
Patch to build ddar on BSD / OS X
--- scan.c.orig 2011-04-28 08:28:05.000000000 +0100
+++ scan.c 2011-04-28 09:01:10.000000000 +0100
@@ -38,6 +38,14 @@
#define likely(x) __builtin_expect(x, 1)
#define unlikely(x) __builtin_expect(x, 0)
+#ifndef __linux__
+#define TEMP_FAILURE_RETRY(expr) \
+ ({ long int _res; \
+ do _res = (long int) (expr); \
Sublime Text 2 - Default shortcuts cheatsheet (PC keyboard)
-----------------
General
-----------------
* Go to file (CTRL + P)
* Go to project (CTRL + ALT + P)
* Go to methods (CTRL + R)
* Go to line (CTRL + G)
* Toggle side bar (CTRL + KB)
@butihuzi
butihuzi / CommUtil.cpp
Created September 23, 2013 09:43
cocos2d-x render to texture with OpenGL CCGLProgram. cocos2d-x 中给 ccSprite 添加灰白滤镜(类似黑白照片效果)。
void CommUtil::disableSprite(CCSprite* sp)
{
const GLchar* pszFragSource =
"#ifdef GL_ES \n \
precision mediump float; \n \
#endif \n \
uniform sampler2D u_texture; \n \
varying vec2 v_texCoord; \n \
varying vec4 v_fragmentColor; \n \
void main(void) \n \
@dvnguyen
dvnguyen / brew.sh
Created January 15, 2017 20:59
Brew Installs for macOs
#!/usr/bin/env zsh
brew update
brew upgrade
# Install GNU core utilities (those that come with macOS are outdated).
# Don’t forget to add `$(brew --prefix coreutils)/libexec/gnubin` to `$PATH`.
brew install coreutils
# Install some other useful utilities like `sponge`.
@yetone
yetone / karabiner.json
Last active September 6, 2021 05:02
Karabiner 通过 left shift 来切换中英文
{
"description": "Switch between zh-Hans <-> en (left_shift)",
"manipulators": [
{
"conditions": [
{
"input_sources": [
{
"language": "en"
}
@quagliero
quagliero / README.md
Last active February 23, 2023 06:07
Installing cpuminer-multi on macOS 10.13.2 (High Sierra)

Installing cpuminer-multi on macOS 10.13.2 (High Sierra)

This assumes you have brew installed and are comfortable using a terminal.

Following the guide on https://github.com/tpruvot/cpuminer-multi will likely lead to errors about invalid paths to OpenSSL, and neoscrypt errors to the tune of Undefined symbols for architecture x86_64 during the build. I managed to piece together different fixes into an installation that has worked for me. So I hope it works for you.

Requirements

Ensure a c compiler is installed. Type g++ in the terminal and continue with the xcode installation if necessary. If it prints clang: error: no input files, then you can proceed.

@sshymko
sshymko / redis.service
Last active April 9, 2023 08:31
Redis service for systemd on Linux
[Unit]
Description=Redis persistent key-value storage
After=network.target
[Service]
Type=notify
ExecStart=/usr/bin/redis-server /etc/redis.conf --supervised systemd --daemonize no
ExecStop=/usr/bin/redis-cli -p 6379 shutdown
ExecReload=/bin/kill -USR2 $MAINPID
Restart=always
@kconragan
kconragan / keyrepeat.shell
Last active December 4, 2023 03:40
Enable key repeat in Apple Lion for Sublime Text in Vim mode
# Mac OS X Lion introduced a new, iOS-like context menu when you press and hold a key
# that enables you to choose a character from a menu of options. If you are on Lion
# try it by pressing and holding down 'e' in any app that uses the default NSTextField
# for input.
#
# It's a nice feature and continues the blending of Mac OS X and iOS features. However,
# it's a nightmare to deal with in Sublime Text if you're running Vintage (Vim) mode,
# as it means you cannot press and hold h/j/k/l to move through your file. You have
# to repeatedly press the keys to navigate.
@jdiaz5513
jdiaz5513 / ascii_arty.py
Last active December 30, 2023 02:32
Console ASCII Art Generator
#! /usr/bin/env python2
# Requires: PIL, colormath
#
# Improved algorithm now automatically crops the image and uses much
# better color matching
from PIL import Image, ImageChops
from colormath.color_conversions import convert_color
from colormath.color_objects import LabColor
from colormath.color_objects import sRGBColor as RGBColor
@teamon
teamon / box.ex
Created August 25, 2017 23:09
Define elixir structs with typespec with single line of code
defmodule Box do
defmacro __using__(_env) do
quote do
import Box
end
end
@doc """
Define module with struct and typespec, in single line