Skip to content

Instantly share code, notes, and snippets.

View stagas's full-sized avatar
🤸

stagas stagas

🤸
View GitHub Profile
@clyfe
clyfe / Git quickie.sh
Created October 19, 2010 18:33
Shows common git commands
#########################
### Set a remote repo ###
#########################
# via ssh
> mkdir projectdir.git
> cd projectdir.git
> git init --bare
or use http://scie.nti.st/2007/11/14/hosting-git-repositories-the-easy-and-secure-way
require.registerExtension('.js', function(js){
return js.replace(/^ *\/\/debug: */gm, '');
});
@matylla
matylla / nodeconf_2011.md
Created May 8, 2011 18:49 — forked from guybrush/nodeconf_2011.md
a list of slides from nodeconf 2011
@tlrobinson
tlrobinson / LICENSE.txt
Created May 17, 2011 08:23 — forked from 140bytes/LICENSE.txt
a JavaScript hash-map kind of thing
Copyright (c) 2011 Tom Robinson, http://tlrobinson.net/
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
@speier
speier / 1. on the server
Last active December 19, 2015 13:49
experimenting with git powered deployment
01. `apt-get install git`
02. `adduser git`
03. `visudo` add `git ALL=(ALL:ALL) NOPASSWD: ALL` to user privilege specification
04. `login git`
05. `ssh-keygen -t rsa`
06. `mkdir project`
07. `mkdir project.git`
08. `cd project.git`
09. `git init --bare`
10. `cd hooks`
@dougalcampbell
dougalcampbell / utfluv.js
Created March 12, 2012 19:44
Handle invalid JS character sequences
/**
* encode to handle invalid UTF
*
* If Chrome tells you "Could not decode a text frame as UTF-8" when you try sending
* data from nodejs, try using these functions to encode/decode your JSON objects.
*
* see discussion here: http://code.google.com/p/v8/issues/detail?id=761#c8
* see also, for browsers that don't have native JSON: https://github.com/douglascrockford/JSON-js
*
* Any time you need to send data between client and server (or vice versa), encode before sending,
@graphnode
graphnode / levenshtein.js
Created May 18, 2011 23:09
levenshtein function in javascript
function levenshtein(s1, s2) {
// http://kevin.vanzonneveld.net
// + original by: Carlos R. L. Rodrigues (http://www.jsfromhell.com)
// + bugfixed by: Onno Marsman
// + revised by: Andrea Giammarchi (http://webreflection.blogspot.com)
// + reimplemented by: Brett Zamir (http://brett-zamir.me)
// + reimplemented by: Alexander M Beedie
// * example 1: levenshtein('Kevin van Zonneveld', 'Kevin van Sommeveld');
// * returns 1: 3
@GabrielMajeri
GabrielMajeri / denormals.md
Last active October 2, 2022 18:49
Enable flushing denormals to zero in Rust

Flushing denormals to zero

Floating-point operations can sometimes result in denormalized numbers or arithmetic underflow. Hardware conforming to IEEE 754 has to support these conditions (albeit with lower performance) to maintain some numerical accuracy.

In certain high-performance applications, it might be beneficial to ignore

#define _GNU_SOURCE
#include <errno.h>
#include <sched.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <sys/mount.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <sys/types.h>
@jaygooby
jaygooby / git_notes.md
Last active October 16, 2023 16:26
Git, you bloody git

Overwrite untracked files in current branch from a remote branch

In a similar vein to git reset --hard feature/weavils you can just overwrite untracked working files (typically left over from branch experiments) which are part of the remote branch you're pulling like this:

git reset --hard origin/feature/weavils

Normally, if you tried git checkout feature/weavils you'd get warnings like untracked working tree files would be overwritten by merge, so hit them with the --hard hammer instead.

(Found via https://stackoverflow.com/q/17404316/391826 and one of the answers: https://stackoverflow.com/a/36824493/391826)