Skip to content

Instantly share code, notes, and snippets.

View bblanchon's full-sized avatar
🌟
No more counting dollars we’ll be counting stars

Benoît Blanchon bblanchon

🌟
No more counting dollars we’ll be counting stars
View GitHub Profile
@devhawk
devhawk / gist:2915352
Created June 12, 2012 05:33
Portable IMetaDataImport p/invoke definition
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MetadataReader
{
using HRESULT = System.UInt32;
@jgonera
jgonera / gist:3084341
Created July 10, 2012 16:05
Google Chart: Scatter Chart with a line
<!doctype html>
<html>
<head>
<title>Google Chart: Scatter Chart with a line</title>
<meta charset="UTF-8" />
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("visualization", "1", { packages: ["corechart"] });
google.setOnLoadCallback(drawChart);
function drawChart() {
@bblanchon
bblanchon / payhip-success.json
Created December 4, 2018 08:14
PayHip: object passed to the success callback
{
"transactionKey": "43ffa7e64bdd0c1ffa3bfcbc551e466aa5346293",
"buyer": "buyer@example.com",
"total": "12.34",
"currency": "USD",
"user_id_hash": "O1wW94N4KT",
"items": [
{
"productName": "My Awesome Product",
"productLink": "oU5g",
@iissnan
iissnan / tail.ps1
Last active December 13, 2020 11:39
Unix tail equivalent command in Windows Powershell
Get-Content ./log.log -Wait -Tail 10
@asika32764
asika32764 / phpos-possible-values.md
Created August 16, 2014 06:18
PHP_OS possible values

Some possible values for PHP predefined constant PHP_OS:

  • CYGWIN_NT-5.1
  • Darwin
  • FreeBSD
  • HP-UX
  • IRIX64
  • Linux
  • NetBSD
  • OpenBSD
@fabianoriccardi
fabianoriccardi / benchmark-json-messagepack.md
Last active July 10, 2021 09:01
Benchmark of JSON vs MessagePack (de)serializazion with ArduinoJson on MCUs
@varmais
varmais / thinced.js
Created October 1, 2015 19:43
Geolocation to Promise wrap example
var getPosition = function (options) {
return new Promise(function (resolve, reject) {
navigator.geolocation.getCurrentPosition(resolve, reject, options);
});
}
getPosition()
.then((position) => {
console.log(position);
})
@bblanchon
bblanchon / GitExecutableFlag.sh
Last active August 8, 2023 13:53
Git: add executable flag to *.sh
find . -name '*.sh' | xargs git update-index --chmod=+x
@vitorfs
vitorfs / example.html
Last active August 23, 2023 05:44
Startswith Template Filter
{% load startswith %}
<li{% if request.path|startswith:'/settings/' %} class="active"{% endif %}>
@julianlam
julianlam / provisioning-unprivileged-lxc-containers-via-login-or-script.md
Last active September 7, 2023 12:45
Provisioning and usage of unprivileged LXC containers via indirect login or script #blog

Provisioning and usage of unprivileged LXC containers via indirect login or script

As I've discovered, managing LXC containers is fairly straightforward, but when building out a system for provisioning out user maintained instances of NodeBB, it was imperative that unprivileged LXC containers were used, so that in the event of shell breakout from NodeBB followed by privilege escalation of the saas user, the root user in the LXC container would only be an unprivileged user on the host machine.

During the course of development, I ran into numerous blockers when it came to managing LXC containers in unexpected circumstances. Namely:

  • Using LXC in a subshell is not directly supported. This usually happens under one of the following two circumstances:
    • After switching users via su or executing lxc-* commands as another user via sudo
    • Executing lxc-* commands via a program, application, or script. In my case, a Node.js application.