Skip to content

Instantly share code, notes, and snippets.

View debdutdeb's full-sized avatar
🩸

Debdut Chakraborty debdutdeb

🩸
View GitHub Profile
@debdutdeb
debdutdeb / compress-pdf-gs.cpp
Last active February 12, 2021 09:40
This is going to be so helpful in the compress-pdf application :D
#ifndef __COMPRESS_H__
#define __COMPRESS_H__
#include "iapi.h"
#include <string>
#include <cstring>
#include <iostream>
#include <errno.h>
static int GSDLLCALL gs_stdout
/* Copyright (C) 2001-2020 Artifex Software, Inc.
All Rights Reserved.
This software is provided AS-IS with no warranty, either express or
implied.
This software is distributed under license and may not be copied,
modified or distributed except as expressly authorized under the terms
of the license contained in the file LICENSE in this distribution.
@debdutdeb
debdutdeb / I.cpp
Last active April 12, 2021 07:22
I like how C++ programs look
#include <iostream>
class Printable {
public:
virtual void print() = 0;
};
class I : public Printable {
private:
std::string *name;
@debdutdeb
debdutdeb / Dockerfile
Created May 2, 2021 06:47
Dockerfile and C program to demonstrate container pausing.
FROM alpine:latest AS builder
WORKDIR /
COPY pause.c .
RUN apk add --no-cache gcc libc-dev && \
gcc -o pause pause.c
FROM alpine:latest
WORKDIR /
@debdutdeb
debdutdeb / Dockerfile
Created May 2, 2021 06:48
Dockerfile and C program to demonstrate container stopping.
FROM alpine:latest AS builder
WORKDIR /
COPY stop.c .
RUN apk add --no-cache gcc libc-dev && \
gcc -o stop stop.c
FROM alpine:latest
@debdutdeb
debdutdeb / inspect.json
Created May 12, 2021 13:03
Docker some nginx container inspect output.
[
{
"Id": "0409779fc2d976387170d664a6aed5ee80a460f8a8dd02c44a02af97df0bb956",
"Created": "2021-05-12T13:00:37.691732507Z",
"Path": "/docker-entrypoint.sh",
"Args": [
"nginx",
"-g",
"daemon off;"
],
@debdutdeb
debdutdeb / README.md
Last active May 17, 2021 03:38
Vagrantfile for LVM testing.
  1. Save this file in your disk and change your PWD to that directory.

  2. Set the environment variable VAGRANT_EXPERIMENTAL to "disks".

export VAGRANT_EXPERIMENTAL=disks
  1. Finally start the vm with vagrant up. You'll definitely see a couple of warning messages like these:-
@debdutdeb
debdutdeb / do.sh
Last active November 26, 2021 12:28
(cd /tmp; wget https://raw.githubusercontent.com/RocketChat/rocketchat-packer/main/image_creation/motd.sh)
cat > /var/lib/cloud/scripts/per-instance/01-set-root-url.sh <<EOF
#!/bin/bash
sed -E "s@^Environment=ROOT_URL=.+@Environment=ROOT_URL=http://\$(curl -s ipinfo.io/ip):3000@" /lib/systemd/system/rocketchat.service -i
systemctl daemon-reload
systemctl restart rocketchat
EOF
chmod +x /var/lib/cloud/scripts/per-instance/01-set-root-url.sh
export SOURCE_NAME=do-marketplace
export ROCKETCHAT_VERSION=latest
@debdutdeb
debdutdeb / README.md
Last active January 21, 2022 14:46
Exporting livechat messages from db

Livechat rooms and messages both are stored in the same collection, rocketchat_room & rocketchat_message.

To first export the livechat rooms as a json file, use mongoexport like so,

mongoexport --collection=rocketchat_room --db=rocketchat \
  --jsonArray -q='{"t": "l"}' --sort='{_id: 1}' --pretty \
  --jsonFormat=canonical --type=json --out=livechat_rooms.json
@debdutdeb
debdutdeb / doom.txt
Created June 25, 2022 13:01 — forked from hjertnes/doom.txt
Doom Emacs Cheatsheet
SPC
SPC: find file
, switch buffer
. browse files
: MX
; EX
< switch buffer
` eval
u universal arg
x pop up scratch