Skip to content

Instantly share code, notes, and snippets.

View Jacajack's full-sized avatar
🦄

Jacek Wieczorek Jacajack

🦄
View GitHub Profile
@luca-m
luca-m / .Xresources
Created July 9, 2013 13:52
.Xresources for urxvt, clipboard CTRL+SHIFT+(C|V|X), CTRL+Arrow for word cursor movement
!! cd /usr/lib/urxvt/perl; git clone https://github.com/muennich/urxvt-perls .
!! Perl extensions
URxvt.perl-ext-common: default,clipboard,matcher,keyboard-select
!! URLs
URxvt.keysym.C-U: perl:url-select:select_next
URxvt.url-launcher: /usr/bin/firefox -new-tab
URxvt.underlineURLs: True
URxvt.matcher.button: 1
/* So how does this work?
I'm using ANSI escape sequences to control the behavior of the terminal while
cat is outputting the text. I deliberately place these control sequences inside
comments so the C++ compiler doesn't try to treat them as code.*/
//
/*The commands in the fake code comment move the cursor to the left edge and
clear out the line, allowing the fake code to take the place of the real code.
And this explanation uses similar commands to wipe itself out too. */
//
#include <cstdio>
@metacollin
metacollin / ltspice.md
Last active April 30, 2022 10:28
LTSpice color scheme - Twilight After Dawn

screenshot

LTSpice color scheme - Twilight After Dawn

                |  R    |  G    |  B    |
Wires           |  138  |  154  |  149  |
Junctions       |  152  |  205  |  255  |
Component body  |  207  |  106  |  76   |
Graphic Flag | 218 | 239 | 163 |
@oleksiiBobko
oleksiiBobko / tcp_server.c
Last active November 10, 2023 08:48
Simple socket server in C using threads (pthread library) Compiles on linux
/*
C socket server example, handles multiple clients using threads
Compile
gcc server.c -lpthread -o server
*/
#include<stdio.h>
#include<string.h> //strlen
#include<stdlib.h> //strlen
#include<sys/socket.h>
@mario52a
mario52a / Macro_FCCircularText.FCMacro
Last active November 17, 2023 17:37
This macro writes a text, standing or flat, circumferential or helical in the manner of Trajan Column and creates a clock with Arabic numerals 1 2 3 ... or Roman I II III ... (inspired to Macro to Create Clock Face to cblt2l). Also to follow the path with selection one wire, edge, line, circle.
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
"""
***************************************************************************
* Copyright (c) 2014 2015 2016 2017 2018 2019 2020 2021 2022 <mario52> *
* 2023 *
* *
* This file is a supplement to the FreeCAD CAx development system. *
* *
* This program is free software; you can redistribute it and/or modify *
@leoloobeek
leoloobeek / get_gists.py
Created April 26, 2017 21:34
Download all gists for a specific user
# first: mkdir user && cd user && cp /path/to/get_gists.py .
# python3 get_gists.py user
import requests
import sys
from subprocess import call
user = sys.argv[1]
r = requests.get('https://api.github.com/users/{0}/gists'.format(user))
@naholyr
naholyr / _service.md
Created December 13, 2012 09:39
Sample /etc/init.d script

Sample service script for debianoids

Look at LSB init scripts for more information.

Usage

Copy to /etc/init.d:

# replace "$YOUR_SERVICE_NAME" with your service's name (whenever it's not enough obvious)
@bloc97
bloc97 / TwoMethods.md
Last active February 20, 2024 12:19
Two Fast Methods of Generating True Random Numbers on the Arduino

Two Fast Methods of Generating True Random Numbers on the Arduino

Arduino true random number generator

B. Peng

December 2017

Abstract

The AVR series microcontrollers are a collection of cheap and versatile chips that are used in many applications ranging from hobbist projects to commercial infrastructure. One major problem for some hobbists is the lack of secure random number generation on the Arduino platform. The included pseudo-random number generator (PRNG) is very easy to defeat and is useless for any crypto-related uses. One recommendation from the Arduino Reference Manual is to use atmospheric noise from the chip's analog sensor pins as seed data[6].
Unfortunately this method is extremely weak and should not be used to emulate a true random number generator (TRNG). Existing methods such as using the internal timer drift or using a dedicated generator are either too slow, requires extensive external hardware or modifications to the microcontroller's internal mech

@thinkl33t
thinkl33t / gist:73e90fd5463622be1ca3f8abd6940659
Last active March 7, 2024 14:17
RGBW Bluetooth LED controller protocol

Controller for an RGBW LED strip purchased from AliExpress

It only appears to fire up the RGB strip or the white strip, never both at once.

Endpoint = 0xb = 0000ffe9-0000-1000-8000-00805f9b34fb

cc2333 - fade on, to whichever output / colour was used last.  Will re-fade if reissued.
cc2433 - fade off

56xxxxxxyyf0aa - change to RGB output - xxxxxx = colour code in hex. yy = anything hexy

@jeffamstutz
jeffamstutz / get_imgui.cmake
Created February 8, 2021 14:35
CMake FetchContent to get ImGui
FetchContent_Populate(imgui
URL https://github.com/ocornut/imgui/archive/docking.zip
SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/imgui
)
set(OpenGL_GL_PREFERENCE "LEGACY")
find_package(OpenGL 2 REQUIRED)
find_package(glfw3 REQUIRED)
add_library(imgui_glfw STATIC