Skip to content

Instantly share code, notes, and snippets.

View nickhutchinson's full-sized avatar

Nicholas Hutchinson nickhutchinson

  • London
View GitHub Profile
@dazuelos
dazuelos / pfdump.sh
Last active October 19, 2023 13:13 — forked from vitaly/pfdump.sh
script to dump PF status
#!/bin/bash
# print an anchor subset (r, n or A)
function pfprint() {
# avoid trusting PATH and .
/usr/bin/sudo pfctl -a "$2" -s"$1" 2>/dev/null
}
@allixsenos
allixsenos / phabricator-map-accounts-to-LDAP.sql
Last active March 11, 2018 13:15
This query will create LDAP mappings for all accounts that don't have them. Useful for migrating from Phacility to self-hosted using LDAP as the only auth method.
USE phabricator_user;
-- create LDAP mappings for unmapped users
-- this query uses a subselect due to the way MySQL reacts to UUID() being
-- wrapped in REPLACE() (returns the same UUID for all rows)
-- WARNING: make sure user.userName maps to LDAP usernames, otherwise
-- user_externalaccount.accountID needs to be modified for those users
-- where it doesn't. alternatively, use Phabricator's change username
-- utility in People app to change those users' usernames before running
INSERT INTO user_externalaccount
@mback2k
mback2k / select_ws.bat
Last active July 31, 2017 12:03
select_ws example program
mingw32-gcc select_ws.c -Wl,-lws2_32 -g -pedantic -Wall -W -Wpointer-arith -Wwrite-strings -Wunused -Wshadow -Winline -Wnested-externs -Wmissing-declarations -Wmissing-prototypes -Wno-long-long -Wfloat-equal -Wno-multichar -Wsign-compare -Wundef -Wno-format-nonliteral -Wendif-labels -Wstrict-prototypes -Wdeclaration-after-statement -Wstrict-aliasing=3 -Wcast-align -Wtype-limits -Wold-style-declaration -Wmissing-parameter-type -Wempty-body -Wclobbered -Wignored-qualifiers -Wconversion -Wno-sign-conversion -Wvla -Wno-pedantic-ms-format -Wno-system-headers -o select_ws.exe
@quarnster
quarnster / cmake_options_script.py
Created October 24, 2012 05:40
SublimeClang options script taking the compilation commands from CMake. Based on @berenm's pull request https://github.com/quarnster/SublimeClang/pull/135
# Based on @berenm's pull request https://github.com/quarnster/SublimeClang/pull/135
# Create the database with cmake with for example: cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
# or you could have set(CMAKE_EXPORT_COMPILE_COMMANDS ON) in your CMakeLists.txt
# Usage within SublimeClang:
# "sublimeclang_options_script": "python ${home}/code/cmake_options_script.py ${project_path:build}/compile_commands.json",
import re
import os
import os.path