Skip to content

Instantly share code, notes, and snippets.

@MrAndrewMal
MrAndrewMal / journalctl.txt
Last active December 8, 2023 00:55
How to read live-tail logs of multiple services with journalctl
#Systemd - How to read live-tail logs of multiple services with journalctl
sudo journalctl --follow _SYSTEMD_UNIT=docker.service + _SYSTEMD_UNIT=apache2.service
@mort3za
mort3za / git-auto-sign-commits.sh
Last active January 30, 2024 10:31
Auto sign your git commits
# Generate a new pgp key: (better to use gpg2 instead of gpg in all below commands)
gpg --gen-key
# maybe you need some random work in your OS to generate a key. so run this command: `find ./* /home/username -type d | xargs grep some_random_string > /dev/null`
# check current keys:
gpg --list-secret-keys --keyid-format LONG
# See your gpg public key:
gpg --armor --export YOUR_KEY_ID
# YOUR_KEY_ID is the hash in front of `sec` in previous command. (for example sec 4096R/234FAA343232333 => key id is: 234FAA343232333)
@williballenthin
williballenthin / .gdbinit
Last active March 14, 2024 19:20
yet another gdb cheatsheet
set disassembly-flavor intel
set disassemble-next-line on
set history save on
set print pretty on
set pagination off
set confirm off
define xxd
dump binary memory dump.bin $arg0 $arg0+$arg1
#!/bin/bash
# Anh Nguyen <anh.ng8@gmail.com>
# 2016-04-30
# MIT License
# This script takes in same-size images from a folder and make a crossfade video from the images using ffmpeg.
# Make sure you have ffmpeg installed before running.
# The output command looks something like the below, but for as many images as you have in the folder.
@yrevar
yrevar / imagenet1000_clsidx_to_labels.txt
Last active April 30, 2024 12:39
text: imagenet 1000 class idx to human readable labels (Fox, E., & Guestrin, C. (n.d.). Coursera Machine Learning Specialization.)
{0: 'tench, Tinca tinca',
1: 'goldfish, Carassius auratus',
2: 'great white shark, white shark, man-eater, man-eating shark, Carcharodon carcharias',
3: 'tiger shark, Galeocerdo cuvieri',
4: 'hammerhead, hammerhead shark',
5: 'electric ray, crampfish, numbfish, torpedo',
6: 'stingray',
7: 'cock',
8: 'hen',
9: 'ostrich, Struthio camelus',
@GabLeRoux
GabLeRoux / archlinux-virtualbox.sh
Last active November 27, 2023 12:22
Virtualbox archlinux notes
# sudo /sbin/rcvboxdrv -h
# Unloading modules:
# Loading modules: modprobe: FATAL: Module vboxnetadp not found in directory /lib/modules/4.4.3-1-ARCH
# modprobe: FATAL: Module vboxnetflt not found in directory /lib/modules/4.4.3-1-ARCH
# modprobe: FATAL: Module vboxpci not found in directory /lib/modules/4.4.3-1-ARCH
# modprobe: FATAL: Module vboxdrv not found in directory /lib/modules/4.4.3-1-ARCH
# Solution
# from https://forum.antergos.com/topic/818/can-t-run-my-vitualbox/4
@mogsdad
mogsdad / Download file from URL.js
Last active December 8, 2023 02:39
In StackOverflow question #14573055, the question was how to "download" a file from a URL using Google Apps-Script. See http://stackoverflow.com/questions/14573055/can-i-download-file-from-url-link-generated-by-google-apps-script/14574217#14574217. You can't actually "download" the source file, because apps-script has no access to your PC's file…
/**
* Retrieve a file from the given URL, store into the named folder
* on Google Drive.
*
* @param {String} fileURL URL to source file, e.g. "http://mysite.com/files/file.val1.val22.zip"
* @param {String} folder Name of target folder on Google Drive
*
* @returns {Object} Response of operation, e.g.
* {rc:200,fileName:"test.zip",fileSize:92994392}
*/
@mkroman
mkroman / Network.cpp
Created November 17, 2011 01:42
Uncrustify configuration inspired by Google's C++ styleguide.
#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <netdb.h>
#include <unistd.h>
#include <string.h>
#include <iostream>
#include <stdarg.h>
#include <stdio.h>
@glacjay
glacjay / tun-ping-linux.py
Created September 18, 2010 04:49
Reading/writing Linux's TUN/TAP device using Python.
import fcntl
import os
import struct
import subprocess
# Some constants used to ioctl the device file. I got them by a simple C
# program.
TUNSETIFF = 0x400454ca
TUNSETOWNER = TUNSETIFF + 2