Skip to content

Instantly share code, notes, and snippets.

View jeromegamez's full-sized avatar
:octocat:

Jérôme Gamez jeromegamez

:octocat:
View GitHub Profile
@mikelehen
mikelehen / generate-pushid.js
Created February 11, 2015 17:34
JavaScript code for generating Firebase Push IDs
/**
* Fancy ID generator that creates 20-character string identifiers with the following properties:
*
* 1. They're based on timestamp so that they sort *after* any existing ids.
* 2. They contain 72-bits of random data after the timestamp so that IDs won't collide with other clients' IDs.
* 3. They sort *lexicographically* (so the timestamp is converted to characters that will sort properly).
* 4. They're monotonically increasing. Even if you generate more than one in the same timestamp, the
* latter ones will sort after the former ones. We do this by using the previous random bits
* but "incrementing" them by 1 (only in the case of a timestamp collision).
*/

Git Cheat Sheet

Commands

Getting Started

git init

or

@marclambrichs
marclambrichs / Vagrantfile
Created December 5, 2015 07:41
install plugins
################################################################################
# check plugins
################################################################################
required_plugins = %w(vagrant-hostmanager vagrant-hosts vagrant-vbguest)
plugins_to_install = required_plugins.select { |plugin| not Vagrant.has_plugin? plugin }
if not plugins_to_install.empty?
puts "Installing plugins: #{plugins_to_install.join(' ')}"
if system "vagrant plugin install #{plugins_to_install.join(' ')}"
exec "vagrant #{ARGV.join(' ')}"
@bitjockey42
bitjockey42 / 00_OSX_Docker_Machine_Setup.md
Last active November 9, 2020 13:49 — forked from andystanton/Start up local Docker Machine on OSX automatically.md
Use native virtualization on OS X docker with xhyve

What this?

So one of the painful points of using docker on OS X is that you need to run a virtualbox VM, which often suffers from performance issues. With xhyve, a OS X virtualization system, and docker-machine-xhyve you can now have docker use the native OS X hypervisor to run containers.

No more dealing with virtualbox shenanigans!

In this script, I've also set up a way to autoconfigure terminal sessions to load docker's environment vars (dependent on docker-machine) so you do not have to run eval $(docker-machine env whatever) every time you open a new terminal window.

Requirements

@vielhuber
vielhuber / script.js
Last active September 22, 2017 23:12
change hover to click in Advanced Menu #shopware
$(document).ready(function() {
$('.navigation-main .navigation--entry').off();
$('.navigation-main .navigation--entry').click(function() {
if( $(this).hasClass('is--hovered') ) {
$(this).removeClass('is--hovered');
$('.advanced-menu .menu--is-active').removeClass('menu--is-active');
return false;
}
else {
$(this).siblings('.is--hovered').removeClass('is--hovered');
@jmaupetit
jmaupetit / watson_prompt.bash
Last active May 3, 2016 10:30
Watson Bash Prompt
# Add this to your ~/.provile or ~/.bashrc depending on your system
#
# watson directory (require watson >= 1.3)
# This value is the default on MacOSX
WATSON_DIR="$HOME/Library/Application Support/watson"
watson_status() {
# colors taken from git-aware-prompt
# https://github.com/jimeh/git-aware-prompt
local txtred="$(tput setaf 1 2>/dev/null || echo '\e[0;31m')" # Red
@kbond
kbond / ExampleTest.php
Last active March 16, 2023 11:44
Laravel Dusk in a non-laravel (Symfony) app
<?php
namespace App\Tests\Browser;
use App\Tests\HasDuskBrowser;
class ExampleTest extends \PHPUnit_Framework_TestCase
{
use HasDuskBrowser;
#!/usr/bin/env bash
export DEBIAN_FRONTEND=noninteractive
sudo -E -H apt-get install -y software-properties-common rkhunter fail2ban
sudo -H apt-add-repository -y -u ppa:ansible/ansible
sudo -H apt-get install -y ansible
sudo -H ansible-galaxy install dev-sec.os-hardening dev-sec.ssh-hardening 2>/dev/null
cat << 'EOF' > hardening-playbook.yml
- hosts: localhost
@nickcernis
nickcernis / readme.md
Last active May 21, 2024 08:47
Exclude node_modules and .git from Backblaze backups on Mac

Exclude node_modules and .git from Backblaze backups on Mac

  1. Edit the file at /Library/Backblaze.bzpkg/bzdata/bzexcluderules_editable.xml.
  2. Add these rules inside the bzexclusions tag:
<!-- Exclude node_modules. -->
<excludefname_rule plat="mac" osVers="*"  ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/node_modules/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
<excludefname_rule plat="mac" osVers="*"  ruleIsOptional="t" skipFirstCharThenStartsWith="users/" contains_1="/.git/" contains_2="*" doesNotContain="*" endsWith="*" hasFileExtension="*" />
@lizthegrey
lizthegrey / attributes.rb
Last active February 24, 2024 14:11
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'