Skip to content

Instantly share code, notes, and snippets.

@ddrown
ddrown / prune
Created October 20, 2014 15:00
Expire quassel backlog
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# run this in the directory ~/.config/quassel-irc.org/
import sqlite3
import time
con = sqlite3.connect('quassel-storage.sqlite')
with con:
@oKcerG
oKcerG / colattachedtype.cpp
Last active April 5, 2017 10:53
Bootstrap grid system PoC in QML
#include "colattachedtype.h"
#include <QQuickItem>
#include <QQuickWindow>
#include <QQmlInfo>
ColAttachedType::ColAttachedType(QObject* parent) :
QObject{parent},
m_item{qobject_cast<QQuickItem*>(parent)}
{
if (!m_item) {
@gfixler
gfixler / EasyJumpPreciseMotionAce.vim
Created July 24, 2012 01:14
A Vim take on Emacs' AceJump mode, itself based on Vim's PreciseJump and EasyMotion plugins
" ACEJUMP
" Based on emacs' AceJump feature (http://www.emacswiki.org/emacs/AceJump).
" AceJump based on these Vim plugins:
" EasyMotion (http://www.vim.org/scripts/script.php?script_id=3526)
" PreciseJump (http://www.vim.org/scripts/script.php?script_id=3437)
" Type AJ mapping, followed by a lower or uppercase letter.
" All words on the screen starting with that letter will have
" their first letters replaced with a sequential character.
" Type this character to jump to that word.
#include <cassert>
#include <memory> // std::addressof
template<typename ResourceTag, typename ResourceType> class Resource {
public:
Resource() noexcept = default;
explicit Resource(ResourceType resource) noexcept : resource_{ resource } {}
Resource(const Resource&) = delete;
Resource& operator=(const Resource&) = delete;
@suy
suy / main.cpp
Created May 25, 2020 07:25
A simple tool to sort and print in a more human readable form the compiler output
#include <QtCore>
static void dump(const char* name, const QStringList& variable) {
QTextStream out(stdout);
out << variable.count() << " " << name << endl;
foreach (const QString& item, variable) {
out << " " << item << endl;
}
}
@rchoudhary
rchoudhary / random.cpp
Created October 29, 2018 07:51
An experiment with random number generation
#include <cstdio>
#include <random>
#include <algorithm>
#include <chrono>
int getRandNum_Old() {
static bool init = false;
if (!init) {
std::srand(time(nullptr)); // Seed std::rand
init = true;
@edsu
edsu / replies.py
Last active December 7, 2022 18:59
Try to get replies to a particular set of tweets, recursively.
#!/usr/bin/env python
"""
Twitter's API doesn't allow you to get replies to a particular tweet. Strange
but true. But you can use Twitter's Search API to search for tweets that are
directed at a particular user, and then search through the results to see if
any are replies to a given tweet. You probably are also interested in the
replies to any replies as well, so the process is recursive. The big caveat
here is that the search API only returns results for the last 7 days. So
@oleavr
oleavr / frida-logging.md
Last active April 7, 2023 08:53
Frida logging hacks

Frida logging helper

For adding temporary logging to help understand behavior. For when it is impractical to use Frida to instrument Frida.

Choose one of these and copy-paste it into e.g. lib/interfaces/session.vala, then use log_event ("name='%s'", name); to log.

When something appears to be hanging, try applying: x-async-debug.patch.

@willprice
willprice / .travis.yml
Last active August 15, 2023 17:12
How to set up TravisCI for projects that push back to github
# Ruby is our language as asciidoctor is a ruby gem.
lang: ruby
before_install:
- sudo apt-get install pandoc
- gem install asciidoctor
script:
- make
after_success:
- .travis/push.sh
env:
@jbache
jbache / NavigationDrawer.qml
Created December 1, 2014 15:02
Qt Quick Navigation Drawer
/*
Copyright (c) 2014 Cutehacks A/S
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions: