Skip to content

Instantly share code, notes, and snippets.

Avatar
🎶

Saurabh tkshnwesper

🎶
View GitHub Profile
@RaVbaker
RaVbaker / readme.md
Created Mar 30, 2012
[HOWTO] Rewrite all urls to one index.php in Apache
View readme.md

Redirect All Requests To Index.php Using .htaccess

In one of my pet projects, I redirect all requests to index.php, which then decides what to do with it:

Simple Example

This snippet in your .htaccess will ensure that all requests for files and folders that does not exists will be redirected to index.php:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
View tmux.md

tmux cheat sheet

(C-x means ctrl+x, M-x means alt+x)

Prefix key

The default prefix is C-b. If you (or your muscle memory) prefer C-a, you need to add this to ~/.tmux.conf:

# remap prefix to Control + a
@richard-flosi
richard-flosi / bottle-cors.py
Created Sep 26, 2012
Bottle with Cross-origin resource sharing (CORS)
View bottle-cors.py
"""
Example of setting up CORS with Bottle.py.
"""
from bottle import Bottle, request, response, run
app = Bottle()
@app.hook('after_request')
def enable_cors():
"""
@jshaw
jshaw / byobuCommands
Last active Oct 20, 2020
Byobu Commands
View byobuCommands
Byobu Commands
==============
byobu Screen manager
Level 0 Commands (Quick Start)
------------------------------
<F2> Create a new window
@tylerneylon
tylerneylon / learn.lua
Last active Oct 13, 2020
Learn Lua quickly with this short yet comprehensive and friendly script. It's written as both an introduction and a quick reference. It's also a valid Lua script so you can verify that the code does what it says, and learn more by modifying and running this script in your Lua interpreter.
View learn.lua
-- Two dashes start a one-line comment.
--[[
Adding two ['s and ]'s makes it a
multi-line comment.
--]]
----------------------------------------------------
-- 1. Variables and flow control.
----------------------------------------------------
@motylwg
motylwg / primesStreamExample.scala
Created Jun 26, 2013
Sieve of Eratosthenes using Scala streams.
View primesStreamExample.scala
def sieve(s: Stream[Int]): Stream[Int] =
s.head #:: sieve(s.tail filter(_ % s.head != 0))
val primes = sieve(Stream.from(2))
primes.take(100).toList
@fperez
fperez / ProgrammaticNotebook.ipynb
Last active Oct 15, 2020
Creating an IPython Notebook programatically
View ProgrammaticNotebook.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mattlewissf
mattlewissf / add-p.md
Last active Oct 13, 2020
Lightning Talk: Git add -p
View add-p.md

git add -p is your friend

git add -p is basically "git add partial (or patch)"

Patch mode allows you to stage parts of a changed file, instead of the entire file. This allows you to make concise, well-crafted commits that make for an easier to read history. This feature can improve the quality of the commits. It also makes it easy to remove parts of the changes in a file that were only there for debugging purposes - prior to the commit without having to go back to the editor.

It allows you to see the changes (delta) to the code that you are trying to add, and lets you add them (or not) separately from each other using an interactive prompt. Here's how to use it:

from the command line, either use

  • git add -p
@sam-artuso
sam-artuso / setting-up-babel-nodemon.md
Last active Sep 18, 2020
Setting up Babel and nodemon
View setting-up-babel-nodemon.md

Setting up Babel and nodemon

Inital set-up

Set up project:

mkdir project
cd project
npm init -y
View gist:96162bb24c242682dc77f29c16f67dd8
##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting. Do not change this entry.
##
127.0.0.1 localhost
255.255.255.255 broadcasthost
::1 localhost
You can’t perform that action at this time.