Skip to content

Instantly share code, notes, and snippets.

View VioletGiraffe's full-sized avatar

Violet Giraffe VioletGiraffe

View GitHub Profile
include(CMakeForceCompiler)
# this one is important
set(CMAKE_SYSTEM_NAME Generic)
# specify the cross compiler
SET(CMAKE_C_COMPILER "D:/Downloads/djgpp/bin/i586-pc-msdosdjgpp-gcc.exe")
SET(CMAKE_CXX_COMPILER "D:/Downloads/djgpp/bin/i586-pc-msdosdjgpp-g++.exe")
# where is the target environment
@JJediny
JJediny / Jenkinsfile
Created February 22, 2017 20:17 — forked from abayer/Jenkinsfile
An example Declarative Pipeline Jenkinsfile for Feb 15 2017 demo
// A Declarative Pipeline is defined within a 'pipeline' block.
pipeline {
// agent defines where the pipeline will run.
agent {
// This also could have been 'agent any' - that has the same meaning.
label ""
// Other possible built-in agent types are 'agent none', for not running the
// top-level on any agent (which results in you needing to specify agents on
// each stage and do explicit checkouts of scm in those stages), 'docker',
@projectgus
projectgus / linpack_bench.ino
Last active March 31, 2021 19:49
Linpack Floating Point benchmark that runs as an Arduino sketch. (Yes, I know...) I wanted to generically measure Arduino Floating Point performance, this seemed like a reasonable(ish) way to do it. Runs with N=10, single precision, but produces sane looking results & residual. (89 Linpack kFLOPS on a Freetronics Eleven, ie Arduino Uno compatibl…
# include <stdlib.h>
# include <stdio.h>
# include <math.h>
int do_benchmark ( void );
double cpu_time ( void );
void daxpy ( int n, double da, double dx[], int incx, double dy[], int incy );
double ddot ( int n, double dx[], int incx, double dy[], int incy );
int dgefa ( double a[], int lda, int n, int ipvt[] );
void dgesl ( double a[], int lda, int n, int ipvt[], double b[], int job );
@fukuroder
fukuroder / wave_play_wasapi_shared.cpp
Last active July 8, 2021 06:38
wave file player (WASAPI shared mode)
/*
* wave_play_wasapi_shared.cpp
*
* Created by fukuroda (https://github.com/fukuroder)
*/
// windows API
#include <windows.h>
#include <audioclient.h>
#include <mmdeviceapi.h>
@adduc
adduc / install.sh
Last active August 24, 2021 09:23
My installation of mercurial, tortoisehg, and hg-git on Ubuntu 20.04 and newer
#!/bin/bash
TARGET_DIR=/opt/repos/third-parties
HG_GIT_VERSION=${1:-default}
HG_RELEASE_VERSION=${2:-5.5.2}
HG_REPO_VERSION=${3:-stable}
TORTOISEHG_VERSION=${4:-stable}
update() {
# Update packages
@billiegoose
billiegoose / ArduinoSerialBypass.ino
Created July 19, 2013 01:37
Use your Arduino as a direct USB to serial converter! Tested on an Arduino Duemilanove. Probably 3.3V TTL but worked for communicating with my supposedly 5V TTL HerkuleX servo at 115200 baud.
/*
* Arduino Serial Bypass - use an Arduino as a dumb USB 2 Serial Converter
*
* This code makes the Arduino not interfere with pins 0 and 1
* which are connected to RX and TX on the FTDI chip. This allows
* the data coming from the FTDI USB 2 Serial chip to flow directly
* to another device. Since RX and TX are labeled from the Arduino's
* point of view, don't cross the wires, but plug the device's
* RX wire into the RX pin 0 and the TX wire into the TX pin 0.
*
'use strict';
const puppeteer = require('puppeteer');
(async () => {
/* PRECONDITION:
0. download ublock, I used https://github.com/gorhill/uBlock/releases/download/1.14.19b5/uBlock0.chromium.zip
1. run $PATH_TO_CHROME --user-data-dir=/some/empty/directory --load-extension=/location/of/ublock
2. enable block lists you want to use
*/
@lukicdarkoo
lukicdarkoo / FFT.c
Last active August 14, 2023 12:49
Basic implementation of Cooley-Tukey FFT algorithm in C++
#include "FFT.h"
void fft(int *x_in,
std::complex<double> *x_out,
int N) {
// Make copy of array and apply window
for (int i = 0; i < N; i++) {
x_out[i] = std::complex<double>(x_in[i], 0);
x_out[i] *= 1; // Window
@9prady9
9prady9 / cpuinfo.cpp
Created September 15, 2015 18:32
Sample code to extract cpu information using CPUID instruction
#include <algorithm>
#include <iostream>
#include <string>
#ifdef _WIN32
#include <limits.h>
#include <intrin.h>
typedef unsigned __int32 uint32_t;
#else
#include <stdint.h>
@holms
holms / gist:5005629
Last active December 21, 2023 16:10
midnight commander dark color theme
Edit mc’s ini file (either ~/.mc/ini or ~/.config/mc/ini) and look for the line [Colors]. Then, change the line base_color to this:
[Colors]
base_color=linux:normal=white,black:marked=yellow,black:input=,green:menu=black:menusel=white:menuhot=red,:menuhotsel=black,red:dfocus=white,black:dhotnormal=white,black:dhotfocus=white,black:executable=,black:directory=white,black:link=white,black:device=white,black:special=white,black:core=,black:stalelink=red,black:editnormal=white,black