Skip to content

Instantly share code, notes, and snippets.

@mendrixsebas
mendrixsebas / github-to-bitbucket
Last active March 28, 2024 11:06 — forked from sangeeths/github-to-bitbucket
Forking a Github repo to Bitbucket
Go to Bitbucket and create a new repository (its better to have an empty repo)
git clone git@bitbucket.org:abc/myforkedrepo.git
cd myforkedrepo
Now add Github repo as a new remote in Bitbucket called "sync"
git remote add sync git@github.com:def/originalrepo.git
Verify what are the remotes currently being setup for "myforkedrepo". This following command should show "fetch" and "push" for two remotes i.e. "origin" and "sync"
git remote -v
@fabiovila
fabiovila / mcpwm.c
Last active March 28, 2024 11:05
How sync ESP32 Timers MCPWM?
// CHANGE the clock prescale in mcpwm.c file to make possible get 30000hz of pwm frequency (15Khz in center aligned mode)
#define MCPWM_BASE_CLK (2 * APB_CLK_FREQ) //2*APB_CLK_FREQ 160Mhz
#define MCPWM_CLK_PRESCL 1 //MCPWM clock prescale Original = 15 <---------------------
#define TIMER_CLK_PRESCALE 1 //MCPWM timer prescales Original = 9 <---------------------
#define MCPWM_CLK (MCPWM_BASE_CLK/(MCPWM_CLK_PRESCL +1))
#define MCPWM_PIN_IGNORE (-1)
#define OFFSET_FOR_GPIO_IDX_1 6
#define OFFSET_FOR_GPIO_IDX_2 75
@jedp
jedp / gist:3005816
Created June 27, 2012 18:18
postMessage() security review checklist

Security-Reviewing Uses of postMessage()

The postMessage() API is an HTML5 extension that permits string message-passing between frames that don't share the same origin. It is available in all modern browsers. It is not supported in IE6 and IE7.

postMessage is generally considered very secure as long as the programmer is careful to check the origin and source of an arriving

@boywijnmaalen
boywijnmaalen / Git cleanup repository
Last active March 28, 2024 11:04
Deletes all dangling commits, objects and blobs
# empty the stash
$ git stash clear
# objects can also be reached through the reflog.
# while branches record the history of some project, reflogs record the history of these branches.
# if you amend, reset etc. commits are removed from the branch history
# but git keeps them around in case you realize that you made a mistake.
# reflogs are a convenient way to find out what destructive (and other) operations were performed
# on a branch (or HEAD), making it easier to undo a destructive operation.
@sangeeths
sangeeths / github-to-bitbucket
Created March 10, 2014 15:24
Forking a Github repo to Bitbucket
Go to Bitbucket and create a new repository (its better to have an empty repo)
git clone git@bitbucket.org:abc/myforkedrepo.git
cd myforkedrepo
Now add Github repo as a new remote in Bitbucket called "sync"
git remote add sync git@github.com:def/originalrepo.git
Verify what are the remotes currently being setup for "myforkedrepo". This following command should show "fetch" and "push" for two remotes i.e. "origin" and "sync"
git remote -v
@HNJAMeindersma
HNJAMeindersma / X-USB PulseAudio.md
Created March 22, 2020 14:38
[Behringer X32 / Midas M32] Split a multi-channel X-USB into virtual outputs with PulseAudio on Linux/Ubuntu

X32/M32 with X-USB on Linux/Ubuntu

This guide is written for all owners of a Behringer X32 or Midas M32 with a X-USB 32x32 channel expansion card. It is directed towards splitting the X-USB channels up in virtual outputs on Ubuntu 18.04 with PulseAudio. The guide may also work for other versions or distro's of Linux with PulseAudio.

It is assumed that the X-USB is installed and connected to a computer. And automatically recognized as a multi-channel soundcard by the operating system. Also note that on Ubuntu 18.04, PulseAudio runs on top of ALSA. ALSA picks up the soundcard and PulseAudio then uses the full soundcard through ALSA to create virtual channels.

Table of contents

  1. Find X-USB device name
  2. Create virtual outputs in PulseAudio
  3. Restart PulseAudio
  4. Control application channel
@OrionReed
OrionReed / DOM3D.js
Last active March 28, 2024 10:59
3D DOM viewer, copy-paste this into your console to visualise the DOM topographically.
// 3D Dom viewer, copy-paste this into your console to visualise the DOM as a stack of solid blocks.
// You can also minify and save it as a bookmarklet (https://www.freecodecamp.org/news/what-are-bookmarklets/)
(() => {
const SHOW_SIDES = false; // color sides of DOM nodes?
const COLOR_SURFACE = true; // color tops of DOM nodes?
const COLOR_RANDOM = false; // randomise color?
const COLOR_HUE = 190; // hue in HSL (https://hslpicker.com)
const MAX_ROTATION = 180; // set to 360 to rotate all the way round
const THICKNESS = 20; // thickness of layers
const DISTANCE = 10000; // ¯\\_(ツ)_/¯
@dmattera
dmattera / launchctl_man_pages.md
Last active March 28, 2024 10:58
macOS man page entries for launchctl services

This list was auto-generated on macOS 10.15 (Catalina) using a script that did the following:

  1. grabbed the name of all the .plist files located in the 5 folders used by launchctl:
  • ~/Library/LaunchAgents Per-user agents provided by the user.
  • /Library/LaunchAgents Per-user agents provided by the administrator.
  • /Library/LaunchDaemons System wide daemons provided by the administrator.
  • /System/Library/LaunchAgents OS X Per-user agents.
  • /System/Library/LaunchDaemons OS X System wide daemons.
@sanxiyn
sanxiyn / lisp.c
Created August 14, 2010 04:16
Lisp
#include <assert.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
enum type {
NIL,
@campusboy87
campusboy87 / wpcf7_modal_invalid.php
Last active March 28, 2024 10:57
Displays a message about the successful submission of the form in a modal window for the Contact Form 7 plugin
<?php
/**
* Plugin Name: CF7 Modal Invalid Answer
* Plugin URI: https://gist.github.com/campusboy87/a056c288c99feee70058ed24cee805ad
* Author: Campusboy (wp-plus)
* Author URI: https://www.youtube.com/wp-plus
*/
add_action( 'wp_enqueue_scripts', 'wpcf7_modal_invalid_js' );
add_action( 'wp_footer', 'wpcf7_modal_invalid_js_inline', 999 );