This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Mock extends Object { | |
userid: string; | |
username: string; | |
} | |
function type_of_extended(a: any): string[] { | |
const to = typeof a; | |
if (["string", "number", "boolean", "null", "undefined"].includes(to)) { | |
return [to]; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from cfbs.pretty import pretty | |
def mock_get_input(): | |
return [ | |
{ | |
"type": "list", | |
"variable": "files", | |
"namespace": "delete_files", | |
"bundle": "delete_files", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bundle agent __main__ | |
{ | |
vars: | |
"mycontext" | |
string => "ubuntu"; | |
reports: | |
"$(mycontext)":: | |
"Hello, $(mycontext) (based on variable)"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This is a script which searches the current | |
// google doc for ticket numbers (based on a regex) | |
// and makes them into links. (To JIRA for example). | |
// It also shortens the links so they only show | |
// ticket number (removing the https... part) | |
// | |
// Edit these 2 variables to fit your needs: | |
const URL = "https://tracker.mender.io/browse/"; | |
const REGEX = "(AC|ARCHIVE|CFE|CO|COOL|ENT|EV|IBT|INF|MAR|MC|MEN|MENWEB|MM|MPPT|NW|QA|SEC|ZEN)\\-[0-9]{1,5}"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
**Northern.tech AS Contributor statement** | |
The terms stated below apply to your contribution of computer code and other | |
material to software or projects owned or managed by Northern.tech AS ("project"), | |
and set out the intellectual property rights in the contributed material you | |
transfer to Cfengine. If this contribution is on behalf of a company, "you" will | |
also mean the company you identify below. | |
1. "Material" and "contribution" shall mean any source code, object code, patch, | |
tool, sample, graphic, specification, manual, documentation, or any other |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import pyglet | |
window = pyglet.window.Window(resizable=True) | |
label = pyglet.text.Label('Hello, world', | |
font_name='Times New Roman', | |
font_size=36, | |
x=window.width//2, y=window.height//2, | |
anchor_x='center', anchor_y='center') | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''Resizable hello world example which works on mac and windows | |
There are a few bugs / differences between pyglet on these platforms. | |
This example tries to work around those issues. | |
Based on: | |
https://bitbucket.org/pyglet/pyglet/issues/78/ | |
https://bitbucket.org/pyglet/pyglet/issues/248/ | |
...and a lot of trial and error. | |
''' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate hyper; | |
use std::fs::File; | |
use std::io::prelude::*; | |
use hyper::{Body, Response, Server}; | |
use hyper::service::service_fn_ok; | |
use hyper::rt::{self, Future}; | |
This file has been truncated, but you can view the full file.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ /var/cfengine/bin/psql -d cfdb -c "\dt" | grep "table" | awk -F "|" '{ print $2 }' | awk '{ print $1 }' | xargs -t -I "{}" /var/cfengine/bin/psql -d cfdb -c 'SELECT * FROM "{}" LIMIT 200;' > dump.txt 2>&1 | |
/var/cfengine/bin/psql -d cfdb -c SELECT * FROM "__agentstatus" LIMIT 200; | |
hostkey | agentexecutioninterval | lastagentlocalexecutiontimestamp | lastagentexecutionstatus | |
----------------------------------------------------------------------+------------------------+----------------------------------+-------------------------- | |
SHA=6654ca75e7c4e40fa75c0ad6c5c05b438fdae052def6e8bea8dacf01c8853a5d | 290 | 2019-01-04 13:43:02+00 | OK | |
SHA=89c60fb122de745572e2b4a9e7d34f61c2474dc15f71ac4203d936744f10aa5c | 292 | 2019-01-04 13:42:57+00 | OK | |
(2 rows) | |
/var/cfengine/bin/psql -d cfdb -c SELECT * FROM "__benchmarkslog" LIMIT 200; | |
hostkey |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <string.h> | |
#include <assert.h> | |
#include <stdbool.h> | |
// Copy at most len bytes, including NUL terminating byte | |
// if src is too long don't terminate | |
// if src is shorter than len, fill remainder with zeroes | |
// return pointer to terminator in dst | |
// if no terminator, return dst + len (address after last byte written) |
NewerOlder