Skip to content

Instantly share code, notes, and snippets.

Avatar
🐯
Rawrrr.

J. R. Schmid sixtyfive

🐯
Rawrrr.
View GitHub Profile
@sixtyfive
sixtyfive / end-gcode
Created Sep 4, 2020
Ender 2 Start- and End-G-code for Cura
View end-gcode
G91 ;Relative positioning
G1 E-60 ;Remove filament from hotend completely
G1 Z5 ;Hover over the print
G90 ;Absolute positioning
G1 X0 Y140 ;Present print
M106 S0 ;Turn off fan
M104 S0 ;Turn off hotend
M140 S0 ;Turn off bed
View play-music
#!/bin/bash
mpv >/dev/null 2>&1 || apt install mpv || eopkg it mpv || pacman -Syu mpv
mpv http://mp3-live.swr.de/swr1bw_m.m3u
View colprint.rb
def colprint(aofas)
s=""; aofas.each{|i,c| s<<i; s<<(' '*(c-i.size+1)) if c>=i.size}; s
end
View unsigned.c
#include <stdio.h>
int main(void) {
unsigned int a = 5;
a -= (unsigned)10;
printf("%i\n", a); // -5 with amd64/gcc, but only by coincidence (undefined!)
printf("%u\n", a); // some really high number; UINTMAX - 5...
}
View gist:6f02d133824ab2f0d74a2bcdaa4a7423
(pad 40c1ac36-0911-4d9a-9109-8897d1953d94 (side top) (shape rect)
(position 1.4 0.0) (rotation 0.0) (size 1.6 1.8) (drill 0.0) (associated_signal_name Thermal_Pad)
)
View clone_repos.sh
#!/bin/bash
GITHUBUSERNAME=""
for repo in $(cat repoURLs.txt); do
git clone $(echo $repo | sed s/LibrePCB-Libraries/$GITHUBUSERNAME/g)
dir=$(basename -s '.git' $repo)
for subdir in cmp cmpcat dev pkg pkgcat sym; do
mkdir -p $dir/$subdir
done
@sixtyfive
sixtyfive / newres.sh
Created May 19, 2020
Add new resolution and change to it right away
View newres.sh
OUT=Virtual-1 X=2560 Y=1440 R=60 bash -c \
'MOD=${X}x${Y}_$R.00; xrandr --newmode $MOD $(cvt $X $Y $R | grep -v "#" | cut -d "\"" -f 3); xrandr --addmode $OUT $MOD; xrandr --output $OUT --mode $MOD'
@sixtyfive
sixtyfive / ocrpdf.rb
Last active Nov 17, 2019
Script that uses Tesseract, Poppler and ImageMagick utilities to OCR a PDF consisting of mere images and make it searchable
View ocrpdf.rb
#!/usr/bin/env ruby
main_lang = ARGV[0]
input_pdf = ARGV[1]
temp_dir = 'temp'
if main_lang && input_pdf
`mkdir -p #{temp_dir}`
print "Splitting PDF into separate pages... "
`pdfseparate "#{input_pdf}" #{temp_dir}/page_%d.pdf`
View happydivali.ino
#include <ShiftRegister74HC595.h>
int numberOfShiftRegisters = 2;
int numberOfCapacitorsToPop = 16;
int serialDataPin = 0;
int clockPin = 1;
int latchPin = 2;
int outputEnablePin = 3;
ShiftRegister74HC595 sr (numberOfShiftRegisters, serialDataPin, clockPin, latchPin);
View tpl0501.ino
#include <SPI.h>
#define PIN_LED GPIO_NUM_4
#define PIN_VREF GPIO_NUM_25
#define PIN_MOSI GPIO_NUM_23
#define PIN_CLOCK GPIO_NUM_18
#define PIN_GAIN_EN GPIO_NUM_12
#define PIN_OFFSET_EN GPIO_NUM_14
void StartSPI()
You can’t perform that action at this time.