Skip to content

Instantly share code, notes, and snippets.

View petabyt's full-sized avatar

Daniel C petabyt

View GitHub Profile
@petabyt
petabyt / a
Last active September 18, 2020 19:59
ASCII with special chars as spaces
!"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[ ]^_`abcdefghijklmnopqrstuvwxyz{|}~ ¡¢£¤¥¦§¨©ª«¬­®¯°±²³´µ¶·¸¹º»¼½¾¿ÀÁÂÃÄÅÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞßàáâãäåæçèéêëìíîïðñòóôõö÷øùúûüýþÿ
@@@@@@@@\b\n\v\f\r@@@@@@@@@@@@@@@@@@ !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~
@petabyt
petabyt / hex.c
Created January 28, 2021 02:53
hex.c
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[]) {
if (argc != 2) {
return -1;
}
FILE *reader = fopen(argv[1], "r");
int c = fgetc(reader);
@petabyt
petabyt / notebook.c
Created August 8, 2021 16:17
GTK 3 Tabbed Notebook Example
...
// Set up notebook
GtkWidget *notebook;
notebook = gtk_notebook_new();
gtk_notebook_set_tab_pos(GTK_NOTEBOOK(notebook), GTK_POS_TOP);
gtk_container_add(GTK_CONTAINER(window), notebook);
gtk_widget_show(notebook);
GtkWidget *grid = gtk_grid_new();
gtk_container_set_border_width(GTK_CONTAINER(grid), 10);
@petabyt
petabyt / pango.c
Created August 8, 2021 16:18
GTK Markup label example
label = gtk_label_new(NULL);
gtk_widget_set_hexpand(label, TRUE);
gtk_label_set_markup(GTK_LABEL(label),
"Hello, World\n"
"<span size='large'>This is a test.</span?");
gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
gtk_grid_attach(GTK_GRID(mainGrid), label, 0, 0, 1, 1);
gtk_widget_show(label);
@petabyt
petabyt / gist:158078fe2aea5e8428bbbee6ea39e10c
Created September 5, 2021 04:45
Installing Python2 and Python2 pip for Magic Lantern
```
sudo apt install python2.7-minimal
# If you want to refer to "python2.7" as "python"
sudo apt install python-is-python2
# Now, get pip2.
wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
sudo python2.7 get-pip.py
```
@petabyt
petabyt / gist:dcd3bbaff54ddc0e6db0d855187858c1
Last active September 5, 2021 06:00
Fixing "error: taking address of packed member of ‘struct QCowHeader’ may result in an unaligned pointer value"
Qemu issue:
```
error: taking address of packed member of ‘struct QCowHeader’ may result in an unaligned pointer value
```
Went into `configure` and removed all `-Werror`
Also had to edit `/home/daniel/Pulled/qemu-eos/qemu-2.5.0/hw/arm/../eos/dbi/backtrace.c:768` and
replace `scnprintf` with `sprintf`.
@petabyt
petabyt / README.md
Created September 15, 2021 17:47
x240 Tweaks

Tweaks for Thinkpad x240 (and maybe other models)

Unlock screen with fingerprint reader (still need keyring)

sudo apt install fprintd

Get more battery life (sometimes double)

sudo apt install auto-cpufreq
@petabyt
petabyt / gist:32def2ea5b13b848d511b4ee24906392
Created September 16, 2021 23:26
AndroidTools Debian setup
# Create local.properties
touch local.properties
echo 'sdk.dir=/usr/lib/android-sdk/' > local.properties
echo 'ndk.dir=/usr/lib/android-ndk/' >> local.properties
@echo 'Installing android stuff via apt. (Ctrl+c to stop)'
@read
# All packages that *might* be needed
sudo apt install android-sdk android-sdk-platform-23
@petabyt
petabyt / init.sh
Created October 6, 2021 00:35
Google Cloud Shell Magic Lantern
# NOTE: cloudshell has hg
git clone https://github.com/reticulatedpines/magiclantern_simplified magic-lantern
# Get gcc
wget https://developer.arm.com/-/media/Files/downloads/gnu-rm/5_4-2016q3/gcc-arm-none-eabi-5_4-2016q3-20160926-linux.tar.bz2?revision=111dee36-f88b-4672-8ac6-48cf41b4d375?product=GNU%20Arm%20Embedded%20Toolchain%20Downloads,32-bit,,Linux,5-2016-q3-update
bzip2 -d gcc*
tar -xf gcc*
# Add GCC to path
echo "export PATH=$PATH:~/gcc-arm-none-eabi-5_4-2016q3/bin" >> ~/.bashrc