Skip to content

Instantly share code, notes, and snippets.

View Climax777's full-sized avatar
🎯
Focusing

Pieter Jordaan Climax777

🎯
Focusing
View GitHub Profile
@Climax777
Climax777 / collectionsafedropper.js
Created May 26, 2014 12:28
MongoDB shell helper for dropping a collection while keeping the indexes
collectionsafedropper = function(database,col) {
var thedb = db.getSiblingDB(database);
var thecoll = thedb[col];
var indexes = thecoll.getIndexes();
print("Dropping: ", database.toString() + "." + col.toString());
thecoll.drop();
indexes.forEach(function(index) {
var key = index.key;
var options = {};
@Climax777
Climax777 / .vimrc
Last active April 28, 2021 03:59
My vimrc file, based on the example vimrc file in Ubuntu, adding a LOT of plugins and settings
" An updated vimrc from the unix example.
" GistID: ef703ea372a15e36d90c
" Maintainer: Pieter Jordaan
" Last change: 13 Sept 2020
"
" To use it, copy it to
" for Unix and OS/2: ~/.vimrc
" for Amiga: s:.vimrc
" for MS-DOS and Win32: $VIM\_vimrc
'use strict';
// Environment variables that grunt will set when the server starts locally. Use for your api keys, secrets, etc.
// You will need to set these on the server you deploy to.
//
// This file should not be tracked by git.
module.exports = {
SESSION_SECRET: "jericho-secret",
FACEBOOK_ID: "app-id",
#include <vector>
#include <algorithm>
#include <iostream>
#include <ctime>
#include <functional>
#define LOG(x) { std::cout << #x << " = " << (x) << "\n"; }
#define TIME(t) { std::cout << ((double)(clock() - (t)) / CLOCKS_PER_SEC) << " s\n"; }
volatile unsigned long long out = 0;
#!/usr/bin/env python3
#GistID: e3db8513a0f3d90b6bdf
import binascii
import sys
def hextoimei(hexstring):
hexstring = hexstring.replace(" ", "")
hexstring = hexstring.replace("0x", "")
hexstring = hexstring.replace("0X", "")
@Climax777
Climax777 / spoof.cpp
Created May 11, 2018 12:52
Spoofing SDP is needed for Chrome/firefox
// Insert this right after getting the offer (create-offer)
// TODO don't override ultimately this will be bad..
gchar* fmtp_value = g_strdup_printf ("96 profile-level-id=%s;packetization-mode=1","42e01f");
GstSDPMedia *sdp_media =
(GstSDPMedia *) & g_array_index (offer->sdp->medias, GstSDPMedia, 0);
for( int i = 0; i < gst_sdp_media_attributes_len(sdp_media); ++i) {
const GstSDPAttribute* attr = gst_sdp_media_get_attribute(sdp_media, i);
if(attr->key)
cout << attr->key << ":";
if(attr->value)
@Climax777
Climax777 / SaveAllAsPDF.vb
Created January 1, 2019 08:37
SaveAllAsPDF vb macro for Word
Sub SaveAllAsPDF()
Dim strFilename As String
Dim strDocName As String
Dim strPath As String
Dim oDoc As Document
Dim fDialog As FileDialog
Dim intPos As Integer
Set fDialog = Application.FileDialog(msoFileDialogFolderPicker)
With fDialog
@Climax777
Climax777 / timestampfixer.sh
Created June 5, 2020 08:13
Fix snapshot timestamps
b = []; a = 0; db.snapshots.find({camera: {$in: ["5dfb35f7bd040908dd2bed04", "5df9e2cfbd040908dd2bec92"]}}, {timestamp:1}).sort({_id: 1}).forEach(function(item) {if(-(item._id.getTimestamp()) + item.timestamp > 5*60*1000) {print('WHAAAT: ' + Math.abs(+(item._id.getTimestamp()) - item.timestamp)/1000/60 + ' ' + +(item._id.getTimestamp()) + ' ' + item.timestamp + item._id.getTimestamp()); a++; b.push(item);}})
b.forEach(function(snap){printjson(snap); db.snapshots.updateOne({_id: snap._id},{$set: {timestamp: +(snap._id.getTimestamp())}})})
adb -t 3 shell ps | grep com.jerichosystems.secutraq | awk '{print $2}' | xargs -I{} adb -t 3 logcat -v color --pid={}
#!/usr/bin/env python
import sys, os, _thread, time, glob, shutil
import gi
import concurrent.futures
gi.require_version('Gst', '1.0')
from gi.repository import Gst, GObject, GLib
outpath = '/mnt/flash/SecuvueFootage'