##Create a new repository on the command line
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin [email protected]:alexpchin/.git
| /* clang hello-asm.c -o hello-asm */ | |
| int main() { | |
| long write = 0x2000004; /* syscall "write" on MacOS X */ | |
| long stdout = 1; | |
| char * str = "Hello World\n"; | |
| unsigned long len = 12; | |
| unsigned long ret = 0; | |
| /* ret = write(stdout, str, len); */ | |
| __asm__("movq %1, %%rax;\n" | |
| "movq %2, %%rdi;\n" |
| #Prefix is Ctrl-a | |
| set -g prefix C-a | |
| bind C-a send-prefix | |
| unbind C-b | |
| set -sg escape-time 1 | |
| set -g base-index 1 | |
| setw -g pane-base-index 1 | |
| #Mouse works as expected |
| #include <math.h> | |
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #include <string.h> | |
| typedef struct Comp { | |
| /* comp of the form: a + bi */ | |
| double a, b; | |
| } Comp; |
##Create a new repository on the command line
touch README.md
git init
git add README.md
git commit -m "first commit"
git remote add origin [email protected]:alexpchin/.git
| # Short of learning how to actually configure OSX, here's a hacky way to use | |
| # GNU manpages for programs that are GNU ones, and fallback to OSX manpages otherwise | |
| alias man='_() { echo $1; man -M $(brew --prefix)/opt/coreutils/libexec/gnuman $1 1>/dev/null 2>&1; if [ "$?" -eq 0 ]; then man -M $(brew --prefix)/opt/coreutils/libexec/gnuman $1; else man $1; fi }; _' |
| # Call scopes directly from your URL params: | |
| # | |
| # @products = Product.filter(params.slice(:status, :location, :starts_with)) | |
| module Filterable | |
| extend ActiveSupport::Concern | |
| module ClassMethods | |
| # Call the class methods with names based on the keys in <tt>filtering_params</tt> | |
| # with their associated values. For example, "{ status: 'delayed' }" would call |
| __author__ = 'robert' | |
| """ | |
| Implementation inspired by Petr Mitrichev's blog post http://petr-mitrichev.blogspot.co.nz/2013/05/fenwick-tree-range-updates.html | |
| and | |
| Yoshiya Miyata's Quora answer http://qr.ae/pHhNN | |
| """ | |
| class Bit: | |
| def __init__(self, n): |
| This uses positive look-ahead to check if there's a string ahead to substitute commas present outside quoted strings. | |
| s/\v,(([^"]*"[^"]*")*[^"]*$)@=/|/g | |
| Explanation: | |
| * "[^"]*" | |
| Match a double-quoted string |
| #include <stdlib.h> | |
| #include <stdio.h> | |
| #define TRUE 1 | |
| #define FALSE 0 | |
| /* a link in the queue, holds the info and point to the next Node*/ | |
| typedef struct { | |
| int info; | |
| } DATA; |
| #!/bin/sh | |
| ### | |
| # SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer) | |
| # For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos | |
| ### | |
| # Alot of these configs have been taken from the various places | |
| # on the web, most from here | |
| # https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx |