Skip to content

Instantly share code, notes, and snippets.

@sbonfert
sbonfert / root-ro
Last active June 24, 2019 17:25 — forked from niun/root-ro
Read-only Root-FS with overlayfs for Raspian
#!/bin/sh
#
# Read-only Root-FS for Raspian
#
# Modified 2016 by Stefan Bonfert to make it compatible with Raspbian
# Jessie (vanilla).
#
# Modified 2015 by Pascal Rosin to work on raspian-ua-netinst with
# overlayfs integrated in Linux Kernel >= 3.18.
#
@kidapu
kidapu / root-ro
Last active April 28, 2020 04:09 — forked from sbonfert/root-ro
Read-only Root-FS with overlayfs for Raspian
#!/bin/sh
#
# Read-only Root-FS for Raspian
#
# Modified 2016 by Stefan Bonfert to make it compatible with Raspbian
# Jessie (vanilla).
#
# Modified 2015 by Pascal Rosin to work on raspian-ua-netinst with
# overlayfs integrated in Linux Kernel >= 3.18.
#
@hayeah
hayeah / c-create-contract.sol.asm
Created October 17, 2017 09:15
c-create-contract.sol.asm
======= c-create-contract.sol:FooFactory =======
EVM assembly:
/* "c-create-contract.sol":44:150 contract FooFactory {... */
mstore(0x40, 0x60)
jumpi(tag_1, iszero(callvalue))
0x0
dup1
revert
tag_1:
tag_2:
@chriswhong
chriswhong / gist:762ceac7fb8a1420e7e7adceb770b707
Last active March 3, 2022 09:01
Using ST_AsMVT() and ST_AsMVTGeom() in express to build a vector tile endpoint
/* GET /tiles/:z/:x/:y.mvt */
/* Retreive a vector tile by tileid */
router.get('/tiles/:z/:x/:y.mvt', async (req, res) => {
const { z, x, y } = req.params;
// calculate the bounding polygon for this tile
const bbox = mercator.bbox(x, y, z, false);
// Query the database, using ST_AsMVTGeom() to clip the geometries
// Wrap the whole query with ST_AsMVT(), which will create a protocol buffer
@Nyx0uf
Nyx0uf / NYXAVCEncoder.swift
Created February 3, 2016 10:35
Hardware accelerated GIF to MP4 converter in Swift using VideoToolbox
import VideoToolbox
import AVFoundation
private var __canHWAVC: Bool = false
private var __tokenHWAVC: dispatch_once_t = 0
public protocol NYXAVCEncoderDelegate : class
{
func didEncodeFrame(frame: CMSampleBuffer)
func didFailToEncodeFrame()
@s8sg
s8sg / single_p_multi_c_buffer.c
Last active September 4, 2022 10:03
A blazing fast single producer multiple consumer lockless queue
/* NOTE: The design decision of the req pool is tuned to get the
* best possible performance. Below point describes
* the design decisions:
* >> reqpool is a buffer queue where the producer adds at the start
* and consumers consume from the end
* >> it is strictly one consumer and multiple producers queue
* >> It is unbounded queue and avoids any resource allocation on heap
* >> It is lockless and use atomic operation to avoid race condition
* for consumers
*/
@stevenmirabito
stevenmirabito / broadcom-wl-dkms.sh
Last active January 5, 2023 19:26
Installs the broadcom-wl kernel module with DKMS
#!/bin/bash
# Installs the broadcom-wl kernel module with DKMS
# Tested under Fedora 23, will likely work with other versions/distros
# Author: Steven Mirabito <smirabito@csh.rit.edu>
# Create a work directory
mkdir -p /tmp/broadcom
cd /tmp/broadcom
# Download the module from Broadcom (http://www.broadcom.com/support/?gid=1)
@L-A
L-A / moonobject.js
Created August 28, 2012 13:20
Moon phase calculation
var MoonInfo = function(day, month, year) {
var n0 = parseInt( "0" );
var f0 = parseFloat( "0.0" );
var AG = f0; // Moon's age
var DI = f0; // Moon's distance in earth radii
var LA = f0; // Moon's ecliptic latitude
var LO = f0; // Moon's ecliptic longitude
var Phase = " ";
var Zodiac = " ";
@mislav
mislav / star-trek-all.tsv
Last active November 1, 2023 03:11
List of Star Trek: The Original Series episodes ranked by their meta-score aggregated from several sites
S-EP episode title score
1-01 The Man Trap -33
1-02 Charlie X 26
1-03 Where No Man Has Gone Before 34
1-04 The Naked Time 64
1-05 The Enemy Within 30
1-06 Mudd's Women -31
1-07 What Are Little Girls Made Of? -1
1-08 Miri -30
1-09 Dagger of the Mind 8
@mkaminsky11
mkaminsky11 / wl_monitor.sh
Last active December 1, 2023 17:59
Enables monitor mode for wl driver(Broadcom)
#!/bin/sh
# so, by default, monitoring and injection cannot be used with Broadcom wl wifi drivers (such as those for Macs)
# this makes it impossible to do stuff like crack wifi passwords with aircrack-ng
# fortunately, there is a solution burried in https://www.broadcom.com/docs/linux_sta/README.txt
echo 1 > /proc/brcm_monitor0 #enables monitor mode. That's it!
# prism0 is now like "mon0" (monitor mode)