Skip to content

Instantly share code, notes, and snippets.

View dmikushin's full-sized avatar
🤓

Dmitry Mikushin dmikushin

🤓
View GitHub Profile
@jeetsukumaran
jeetsukumaran / custom_iterator.cpp
Created February 18, 2010 02:33
Sample C++/STL custom iterator
// Sample custom iterator.
// By perfectly.insane (http://www.dreamincode.net/forums/index.php?showuser=76558)
// From: http://www.dreamincode.net/forums/index.php?showtopic=58468
#include <iostream>
#include <vector>
#include <algorithm>
#include <iterator>
#include <cassert>
@fredrick
fredrick / screen.md
Created September 14, 2011 15:30
GNU Screen Cheat Sheet

#GNU Screen Cheat Sheet

##Basics

  • ctrl a c -> cre­ate new win­dow
  • ctrl a A -> set win­dow name
  • ctrl a w -> show all win­dow
  • ctrl a 1|2|3|… -> switch to win­dow n
  • ctrl a " -> choose win­dow
  • ctrl a ctrl a -> switch between win­dow
  • ctrl a d -> detach win­dow
@cloderic
cloderic / main.cpp
Created February 9, 2012 13:45
WinMain to standard main
#ifdef WIN32
int WINAPI WinMain(HINSTANCE instance, HINSTANCE prev_instance, char* command_line, int show_command)
{
int argc;
char** argv;
char* arg;
int index;
int result;
// count the arguments
@springmeyer
springmeyer / boost-backporting-guide.md
Last active January 11, 2021 18:57
How to backport recent Boost packages to older ubuntu distro's and build using personal PPA

Boost backporting

Goal here is to document the steps I took in May 2012 to get Boost 1.49 packages backported and working on Lucid, Maverick, Natty, Oneiric, and Precise.

TODO: look into using ubuntu-dev-tools and backportpackage -s [new_release] -d [old_release] -u [ppa] [package_name]

Install dev tools

sudo apt-get install debhelper devscripts dput git-core python pgpgpg
@shaunlebron
shaunlebron / README.md
Created May 31, 2012 15:00
Iterating Combinations

Iterating Combinations

If you're trying to iterate all combinations of k=5 on n=36, this is how you loop through them.

int k = 5;
int n = 36;
int count = 0;
for (int i1=1; i1 &lt;= n-k+1; i1++)
@jeetsukumaran
jeetsukumaran / binomial_coefficient.cpp
Created April 15, 2013 23:31
Calculating the binomial coefficient in C++.
/**
* Calculates the binomial coefficient, $\choose{n, k}$, i.e., the number of
* distinct sets of $k$ elements that can be sampled with replacement from a
* population of $n$ elements.
*
* @tparam T
* Numeric type. Defaults to unsigned long.
* @param n
* Population size.
* @param k
@richard-to
richard-to / x11_screen_grab.cpp
Created April 7, 2014 10:30
X11 Example code for grabbing screenshots of window and sending key events
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <X11/Xlib.h>
@NLKNguyen
NLKNguyen / Ubuntu install kernel -dbgsym
Last active March 24, 2022 00:25
Ubuntu - Install Debug Symbol Package (-dbgsym) for the current Linux kernel
codename=$(lsb_release -c | awk '{print $2}')
sudo tee /etc/apt/sources.list.d/ddebs.list << EOF
deb http://ddebs.ubuntu.com/ ${codename} main restricted universe multiverse
deb http://ddebs.ubuntu.com/ ${codename}-security main restricted universe multiverse
deb http://ddebs.ubuntu.com/ ${codename}-updates main restricted universe multiverse
deb http://ddebs.ubuntu.com/ ${codename}-proposed main restricted universe multiverse
EOF
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys ECDCAD72428D7C01
sudo apt-get update
@iamtekeste
iamtekeste / Download Google Drive files with WGET
Created July 8, 2015 11:00
Download Google Drive files with WGET
Download Google Drive files with WGET
Example Google Drive download link:
https://docs.google.com/open?id=[ID]
To download the file with WGET you need to use this link:
https://googledrive.com/host/[ID]
Example WGET command:
@cboettig
cboettig / docker-compose.yml
Last active December 31, 2023 15:23
debugging NGINX configuration for Jupyter
jupyter:
image: jupyter/datascience-notebook
environment:
- PASSWORD=${PASSWORD}
nginx:
image: nginx
links:
- jupyter