Skip to content

Instantly share code, notes, and snippets.

@ivant
ivant / cxx-infinite-loop.cc
Created March 12, 2012 22:13
C++ compiler infinite loop
template <class T>
struct Loop {
Loop<T *> operator->();
};
int main() {
Loop<int> i, j = i->hooray;
}
@danharper
danharper / background.js
Last active June 29, 2024 19:32
Bare minimum Chrome extension to inject a JS file into the given page when you click on the browser action icon. The script then inserts a new div into the DOM.
// this is the background code...
// listen for our browerAction to be clicked
chrome.browserAction.onClicked.addListener(function (tab) {
// for the current tab, inject the "inject.js" file & execute it
chrome.tabs.executeScript(tab.ib, {
file: 'inject.js'
});
});
Start GDB and execute the following commands:
catch syscall ptrace
commands 1
set ($eax) = 0
continue
end
Then, run the app and voilá! you can debug your program :)
@aallan
aallan / mac-vendor.txt
Last active June 19, 2024 21:35
List of MAC addresses with vendors identities
000000 Officially Xerox
000001 SuperLAN-2U
000002 BBN (was internal usage only, no longer used)
000003 XEROX CORPORATION
000004 XEROX CORPORATION
000005 XEROX CORPORATION
000006 XEROX CORPORATION
000007 XEROX CORPORATION
000008 XEROX CORPORATION
000009 powerpipes?
{
"cmd": ["g++", "-std=c++11", "${file}", "-o", "${file_base_name}.exe", "&&", "start", "cmd", "/k" , "$file_base_name"],
"file_regex": "^(..[^:]*):([0-9]+):?([0-9]+)?:? (.*)$",
"working_dir": "${file_path}",
"selector": "source.c, source.c++",
"shell": true,
"variants":
[
{
# Copyright (C) 2012 The CyanogenMod Project
# (C) 2017 The LineageOS Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
All times are in GMT+7, Hanoi.
================================
Generated 20:22, March 24th 2018
================================
86067916 -- 12:32, March 25th 2018
45856040 -- 16:46, March 25th 2018
32356708 -- 11:57, March 30th 2018
32455175 -- 20:41, March 30th 2018
23532432 -- 19:43, March 31th 2018
@dungwinux
dungwinux / deploy.bat
Created April 6, 2018 08:22
Competitive quick deploy
@echo off
set /p name="Archive Name: "
mkdir %name%
REM VVV Change cpp to file extension you want
copy *.cpp %name%
7z a %name%.zip %name%/
rmdir /S /Q %name%
@minhducsun2002
minhducsun2002 / lis.cpp
Last active May 5, 2018 00:45
LIS using Patience Sorting
#include <bits/stdc++.h>
using namespace std;
typedef long long int llint;
const long long int LLINT_MAX = LLONG_MAX;
const long long int LLINT_MIN = LLONG_MIN;
vector <vector <llint> > sort_to_piles (vector <llint> arr)
{
@minhducsun2002
minhducsun2002 / environmentsetup_allheaders.cpp
Last active August 2, 2018 01:03
Precompiled list of headers and definitions
#include <cstdlib>
#include <bitset>
#include <functional>
#include <utility>
#include <ctime>
#include <chrono>
#include <cstddef>
#include <initializer_list>
#include <tuple>
#include <new>