Skip to content

Instantly share code, notes, and snippets.

@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active April 25, 2024 06:23
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@danharper
danharper / gulpfile.js
Last active April 11, 2024 08:31
New ES6 project with Babel, Browserify & Gulp
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var source = require('vinyl-source-stream');
var buffer = require('vinyl-buffer');
var browserify = require('browserify');
var watchify = require('watchify');
var babel = require('babelify');
function compile(watch) {
var bundler = watchify(browserify('./src/index.js', { debug: true }).transform(babel));
@w0rd-driven
w0rd-driven / passwords.txt
Created November 18, 2016 20:19
BFG Repo-Cleaner --replace-text example
PASSWORD1 # Replace literal string 'PASSWORD1' with '***REMOVED***' (default)
PASSWORD2==>examplePass # replace with 'examplePass' instead
PASSWORD3==> # replace with the empty string
regex:password=\w+==>password= # Replace, using a regex
regex:\r(\n)==>$1 # Replace Windows newlines with Unix newlines
@Birch-san
Birch-san / local-copilot.md
Last active March 12, 2024 15:14
Running GitHub Copilot against local Code Llama model

Running GitHub Copilot VSCode extension against local Code Llama model

image

image

Tested on NVIDIA RTX 4090, but these instructions also cover AMD and Mac in case you wanna try those.
This guide assumes you are running Linux (I ran this on Ubuntu).

Before you get excited:

@zhengjia
zhengjia / capybara cheat sheet
Created June 7, 2010 01:35
capybara cheat sheet
=Navigating=
visit('/projects')
visit(post_comments_path(post))
=Clicking links and buttons=
click_link('id-of-link')
click_link('Link Text')
click_button('Save')
click('Link Text') # Click either a link or a button
click('Button Value')
@jbarona
jbarona / gist:3444459
Created August 24, 2012 01:23
Timestamp fun
# no config
Time.now is localtime
1.second.from_now is UTC
Timestamp stored in UTC
AR not translated
Time.now: Fri Aug 24 10:22:25 +0930 2012
1.second.from_now 2012-08-24 00:52:26 UTC
@jirikuncar
jirikuncar / README.md
Last active April 23, 2021 17:44
Traefik - header matching

Traefik routing

Proxy to services based on Accept header.

Run

docker-compose up -d

Test

@jacqui
jacqui / gist:983051
Created May 20, 2011 14:43 — forked from pauldix/gist:981916
Redis SORT command examples
# Optimized for writes, sort on read
# LVC
redis.hset("bonds|1", "bid_price", 96.01)
redis.hset("bonds|1", "ask_price", 97.53)
redis.hset("bonds|2", "bid_price", 95.50)
redis.hset("bonds|2", "ask_price", 98.25)
redis.sadd("bond_ids", 1)
redis.sadd("bond_ids", 2)
@d11wtq
d11wtq / let.js
Created August 18, 2012 05:54
RSpec style let() in Jasmine/Mocha
/**
* Get RSpec-style let() in your Mocha/Jasmine specs.
*/
var let = function (callback) {
var value, called = false;
var memoizer = function() {
if (called) {
return value;
} else {
called = true;
@jasoncodes
jasoncodes / create_item_children_count.rb
Created October 23, 2011 19:04
Create ActiveRecord models for database views
class CreateItemChildrenCountView < ActiveRecord::Migration
def self.up
execute <<-SQL
CREATE VIEW item_children_count AS
SELECT parent_id AS item_id, COUNT(*) as children_count
FROM items GROUP BY parent_id;
SQL
end
def self.down