Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.
$ python -m SimpleHTTPServer 8000
The long way of json decoding | |
var result map[string]interface{} | |
err = json.NewDecoder(res.Body).Decode(&result) | |
if err != nil { | |
fmt.Printf("JSON Decode ERROR: %s", err) | |
check.GoExit("") | |
} |
// https://golang.org/doc/effective_go | |
// https://nanxiao.gitbooks.io/golang-101-hacks/content/ | |
## For Loops | |
// Reverse a | |
for i, j := 0, len(a)-1; i < j; i, j = i+1, j-1 { | |
a[i], a[j] = a[j], a[i] | |
} | |
## Type Switch |
package main | |
import ( | |
"fmt" | |
"os" | |
"os/exec" | |
"syscall" | |
) | |
func main() { |
#!/bin/bash | |
# change url and cookie if needed | |
name=dummy-alert | |
url='http://localhost:8000/alertmanager/api/v1/alerts' | |
COOKIE='' | |
echo "firing up alert $name" | |
# change url o |
I hereby claim:
To claim this, I am signing this object:
extern crate serde; | |
use base64; | |
use hex::FromHex; | |
use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; | |
use std::convert::TryFrom; | |
#[derive(Serialize, Deserialize, Debug)] | |
pub struct Config { | |
#[serde(serialize_with = "as_base64", deserialize_with = "from_base64")] | |
key: [u8; 32], |
/* | |
Question: https://jrms-random-blog.blogspot.com/2021/03/a-google-interview-question.html | |
Shor: building a tic tac toe winning algo | |
Solutions | |
map: 4x4 | |
3 O O O O 8 | |
2 O O O O 8 | |
1 O O O O 8 |
/* | |
iflist.c : retrieve network interface information thru netlink sockets | |
(c) Jean Lorchat @ Internet Initiative Japan - Innovation Institute | |
v1.0 : initial version - Feb 19th 2010 | |
This file was obtained at the following address : | |
http://www.iijlab.net/~jean/iflist.c |
<?php | |
if (!extension_loaded('xmlrpc')) { | |
echo "PHP xmlrpc extension is not available."; | |
die; | |
} | |
function call($remoteUri, $localUri, $username, $password) | |
{ | |
$requestParameter = array( | |
'RemoteUri' => sprintf('sip:%s@sipgate.de', $remoteUri), |