(This is a backup of https://samulinatri.com/blog/memory-management)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// From: https://cplusplus.com/forum/beginner/94946/ | |
// By: https://cplusplus.com/user/Disch/ | |
#define FPS 60 | |
int frame_length = 1000 / FPS; // Number of ms between frames. 17 gives you approx 60 FPS (1000 / 60) | |
Uint32 next_frame; // Timestamp that next frame is to occur | |
int skipped_frames; // Number of frames we have skipped |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Source material: | |
http://security.stackexchange.com/questions/24444/what-is-the-most-hardened-set-of-options-for-gcc-compiling-c-c | |
https://wiki.gentoo.org/wiki/Hardened_Gentoo | |
https://wiki.debian.org/Hardening | |
================================================================================================================> | |
GCC Security related flags and options: | |
CFLAGS="-fPIE -fstack-protector-all -D_FORTIFY_SOURCE=2" | |
LDFLAGS="-Wl,-z,now -Wl,-z,relro" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# A simple plugin for hiding/showing all layers. | |
from gimpfu import * | |
def hide_show_all_layers(origin, hide): | |
layers = origin.layers | |
pdb.gimp_undo_push_group_start(origin) |
I often find myself using Byobu on a Linux machine when connected to it over SSH. In doing so, I've noticed that many of the documented keyboard shortcuts don't work. This can be due to the native PC's OS intercepting certain keys, or possibly other reasons.
Below is a cheatsheet with Byobu features I have found usually work when run over a SSH connection.
Action | Windows + Putty to Ubuntu | MacOS + Terminal to Ubuntu |
---|---|---|
Help menu | BASH: byobu-config | FN-F1 |
Create new window | CTRL-a c | CTRL-a c or FN-F2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:lua vim.api.nvim_open_win(0, true, {relative='win', width=200, height=200, row=16, col=16}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Taking a few things from my fish cfg back to bash: vi keys, branch name in prompt, custom prompt, completion (with fzf) | |
# Custom prompt | |
# Vi keys | |
# History | |
# Completion (Using fzf & fzf-tab-completion) | |
# Tip: Install bashmarks and fasd for faster directory browsing | |
# Custom prompt: Add to .bashrc | |
# Helps reset prompt when tty crashes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env node | |
/* | |
Usage: ./to-netscape-bookmarks.sh urls | tee bookmarks.html | |
urls is a simple textfile with urls separated by breakline | |
Titles are pulled with pup tool | |
*/ | |
const { exec } = require('child_process'), fs = require('fs'), readline = require('readline') | |
const file = process.argv[2] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# A simple plugin for copying layers. | |
# The layers can be copied in normal or reverse order, | |
# and can be placed at the top or bottom of the destination's layers, | |
# or above the selected layer in the destination. | |
from gimpfu import * | |
def copy_layers(origin, dest, order, position): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# GIMP Python plug-in template. | |
# To run the plugin, place it in .config/GIMP/plug-ins/PLUG_DIR/PLUG_NAME.py | |
# Where PLUG_DIR and PLUG_NAME are the name of your script e.g. myscript/myscript.py | |
# Note for AppImage version replace GIMP with GIMP-AppImage | |
# make the script executable (chmod +x myscript.py) | |
from gimpfu import * |
NewerOlder