Skip to content

Instantly share code, notes, and snippets.

View ColdGrub1384's full-sized avatar

Emma Cold ColdGrub1384

View GitHub Profile
@xavierd
xavierd / complete.cc
Created December 29, 2010 15:20
Hacking with libclang completion.
#include <clang-c/Index.h>
#include <cstdlib>
#include <iostream>
/*
* Compile with:
* g++ complete.cc -o complete -lclang -L/usr/lib/llvm
* Run with:
* LIBCLANG_TIMING=1 ./complete file.cc line column [clang args...]
*/
@hoelzro
hoelzro / repl.lua
Created October 5, 2011 18:28
A Lua REPL implemented in Lua
do
local buffer = ''
local function gather_results(success, ...)
local n = select('#', ...)
return success, { n = n, ... }
end
local function print_results(results)
@rajatkhanduja
rajatkhanduja / fdToStream.cpp
Created March 10, 2012 19:49
Converting a file descriptor to an istream or ostream (with g++-4.5) [ non-portable method ]
#include <iostream>
#include <ext/stdio_filebuf.h>
using __gnu_cxx::stdio_filebuf;
using std::istream;
using std::ostream;
inline stdio_filebuf<char> * fileBufFromFD (int fd, std::_Ios_Openmode mode)
{
return (new stdio_filebuf<char> (fd, mode));
@steventroughtonsmith
steventroughtonsmith / gist:6763213
Created September 30, 2013 12:39
Non-opaque application windows in iOS 7, with optional blur. Shows the user's wallpaper under the app, with Parallax if supported.
typedef enum _UIBackgroundStyle {
UIBackgroundStyleDefault,
UIBackgroundStyleTransparent,
UIBackgroundStyleLightBlur,
UIBackgroundStyleDarkBlur,
UIBackgroundStyleDarkTranslucent
} UIBackgroundStyle;
@interface UIApplication (UIBackgroundStyle)
-(void)_setBackgroundStyle:(UIBackgroundStyle)style;
@iamnewton
iamnewton / bash-colors.md
Last active July 25, 2024 19:33
The entire table of ANSI color codes.

Regular Colors

Value Color
\e[0;30m Black
\e[0;31m Red
\e[0;32m Green
\e[0;33m Yellow
\e[0;34m Blue
\e[0;35m Purple
@zachmayer
zachmayer / openblas.sh
Last active March 14, 2022 03:20
Mac BLAS
#Option 1 - install openblas with homebrew and link to CRAN installed R
brew tap homebrew/science
brew install openblas
ln -sf /usr/local/Cellar/openblas/0.2.12/lib/libopenblas.dylib /Library/Frameworks/R.framework/Resources/lib/libRblas.dylib
#Option 2 - install r with openblas through homebrew
brew tap homebrew/science
brew install r --with-openblas
@phatmann
phatmann / ImageAttachment
Created March 22, 2015 22:23
NSTextAttachment that scales and aligns image
// Created by Tony Mann on 3/22/15.
// Copyright (c) 2015 7Actions. All rights reserved.
//
// Adapted from http://ossh.com.au/design-and-technology/software-development/implementing-rich-text-with-images-on-os-x-and-ios/
import UIKit
class ImageAttachment: NSTextAttachment {
var verticalOffset: CGFloat = 0.0
@natefoo
natefoo / 00README.md
Last active July 20, 2024 07:25
Linux Distribution Detection

Distribution Detection

I am working on adding support for building and distributing (via PyPI) Python Wheels with C Extensions to the Python wheel and pip packages. The discussion on Distutils-SIG continues, but I believe it is fairly certain that some effort to correctly identify Linux distributions will need to be made. I've begun efforts to add this support to wheel.

How you can help

If you have a Linux distribution or version of a listed distribution not in this gist, or one of the ones I have not directly verified, I could use the following:

  • The contents of /etc/os-release, if it exists
function urlencode(str)
if (str) then
str = string.gsub (str, "\n", "\r\n")
str = string.gsub (str, "([^%w ])",
function (c) return string.format ("%%%02X", string.byte(c)) end)
str = string.gsub (str, " ", "+")
end
return str
end
import UIKit
class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()
let showAlertButton = UIButton(type: UIButtonType.Custom)
showAlertButton.frame = CGRectMake(0, 0, 100, 40)
showAlertButton.setTitle("Show Alert", forState: .Normal)