Skip to content

Instantly share code, notes, and snippets.

View chmouel's full-sized avatar
🤨
Kuberneting

Chmouel Boudjnah chmouel

🤨
Kuberneting
View GitHub Profile
#!/bin/bash
STATUS=$(echo pow 0|cec-client -s -d 1|grep power\ status|sed 's/.*: //')
if ! grep -i apple /proc/bus/input/devices && [[ ${STATUS} == on ]] ;then
sudo /bin/hciconfig hci0 up
echo "on" > /tmp/xxx
elif grep apple /proc/bus/input/devices && [[ ${STATUS} != on ]] ;then
sudo /bin/hciconfig hci0 down
echo "off" > /tmp/xxx
<html>
<head>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/angularjs/1.6.1/angular.min.js"></script>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/js-yaml/3.7.0/js-yaml.min.js"></script>
<script type="text/javascript">
var app = angular.module("Test", []);
app.controller("T", ['$scope', '$http', function($scope, $http) {
var res = $http.get('config/frack.yaml');
res.then(function succesCB(r) {
yaml = jsyaml.load(r.data);;
from stravalib.client import Client
from flask import Flask
from flask import request
from flask import redirect
app = Flask(__name__)
client = Client()
access_token = None
package server
import (
"log"
"os"
"github.com/davecgh/go-spew/spew"
)
func Debug(a ...interface{}) {
func debugVargs(args ...interface{}) {
fmt.Printf("(")
cnt := 1
for _, v := range args {
fmt.Printf("'%s'", v)
if cnt != len(args) {
fmt.Printf(", ")
}
cnt += 1
}
#!/bin/bash
set -ex
project=$1
[[ -z ${project} ]] && {
echo "Need a project name"
exit 1
}
[[ -d ${project} ]] && {
;; Just use ff-find-other-file instead
(defun go-switch-test-and-back ()
(interactive)
(let ((ext (file-name-extension (buffer-file-name)))
(base-fname
(file-name-sans-extension buffer-file-name))
target)
(if (string-match "_test\\'" base-fname)
(setq target (concat (replace-regexp-in-string
"_test\\'" "" base-fname)
@chmouel
chmouel / utils.go
Created March 2, 2017 07:59
Some utils for me
package utils
import (
"crypto/rand"
"encoding/hex"
"fmt"
"log"
"os"
"path/filepath"
#!/bin/bash
set -ef
# dont put slash at the end or that would fail
URL=""
TOKEN=$(curl -f -k -s -k "${URL}/auth/realms/master/protocol/openid-connect/token" -H "Content-Type: application/x-www-form-urlencoded" -d "username=admin" -d 'password=admin' -d 'grant_type=password' -d 'client_id=admin-cli'|python -c 'import sys, json; print json.load(sys.stdin)["access_token"]')
curl -f -s -k "${URL}/auth/admin/realms" -H "Accept: application/json" -H "Authorization: Bearer $TOKEN" | python -mjson.tool
diff --git a/controller/controller.go b/controller/controller.go
index f2b6cfd9..93765503 100644
--- a/controller/controller.go
+++ b/controller/controller.go
@@ -1,6 +1,7 @@
package controller
import (
+ "crypto/tls"
"encoding/json"