Skip to content

Instantly share code, notes, and snippets.

@g2g
g2g / DefaultKeyBinding.dict
Created November 18, 2023 06:58 — forked from trusktr/DefaultKeyBinding.dict
My DefaultKeyBinding.dict for Mac OS X
/* ~/Library/KeyBindings/DefaultKeyBinding.Dict
This file remaps the key bindings of a single user on Mac OS X 10.5 to more
closely match default behavior on Windows systems. This makes the Command key
behave like Windows Control key. To use Control instead of Command, either swap
Control and Command in Apple->System Preferences->Keyboard->Modifier Keys...
or replace @ with ^ in this file.
Here is a rough cheatsheet for syntax.
Key Modifiers
@g2g
g2g / gist:661bc31e9e9c79cc4d0ab54ff7054840
Created February 21, 2023 13:04 — forked from CrookedNumber/gist:8964442
git: Removing the last commit

Removing the last commit

To remove the last commit from git, you can simply run git reset --hard HEAD^ If you are removing multiple commits from the top, you can run git reset --hard HEAD~2 to remove the last two commits. You can increase the number to remove even more commits.

If you want to "uncommit" the commits, but keep the changes around for reworking, remove the "--hard": git reset HEAD^ which will evict the commits from the branch and from the index, but leave the working tree around.

If you want to save the commits on a new branch name, then run git branch newbranchname before doing the git reset.

@g2g
g2g / ansible_local_playbooks.md
Created July 19, 2022 14:19 — forked from alces/ansible_local_playbooks.md
How to run an Ansible playbook locally
  • using Ansible command line:
ansible-playbook --connection=local 127.0.0.1 playbook.yml
  • using inventory:
127.0.0.1 ansible_connection=local
@g2g
g2g / keepass2john.py
Created June 21, 2022 13:01 — forked from HarmJ0y/keepass2john.py
Python port of John the Ripper's keepass2john - extracts a HashCat/john crackable hash from KeePass 1.x/2.X databases
#!/usr/bin/python
# Python port of keepass2john from the John the Ripper suite (http://www.openwall.com/john/)
# ./keepass2john.c was written by Dhiru Kholia <dhiru.kholia at gmail.com> in March of 2012
# ./keepass2john.c was released under the GNU General Public License
# source keepass2john.c source code from: http://fossies.org/linux/john/src/keepass2john.c
#
# Python port by @harmj0y, GNU General Public License
#
@g2g
g2g / .gitlab-ci.yml
Created April 26, 2022 12:54 — forked from waja/.gitlab-ci.yml
Ansible molecule Gitlab CI
# See https://gitlab.com/richardskumat/ansible-role-client-debian-role/-/blob/master/.gitlab-ci.yml
image: qwe1/dind-ansible-molecule:latest
variables:
# DOCKER_HOST: tcp://docker:2375/
DOCKER_DRIVER: overlay2
# https://gitlab.com/gitlab-org/gitlab-ce/issues/64959
# 19.03 had some breaking changes compared to 18.09
DOCKER_TLS_CERTDIR: ""
services:
@g2g
g2g / web-servers.md
Created April 26, 2022 12:49 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@g2g
g2g / nweb.c
Created April 26, 2022 12:43 — forked from cybertxt/nweb.c
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <signal.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
@g2g
g2g / commandlinefu
Last active April 21, 2022 06:06 — forked from seungwon0/commandlinefu
Simple shell script using commandlinefu.com API
#!/bin/sh
#
# commandlinefu - Simple shell script using commandlinefu.com API
#
# All commands sorted by date:
# % commandlinefu
#
# All commands sorted by votes:
# % commandlinefu -v
#